2014-04-28 22:05:37 +02:00
|
|
|
module.exports = function(grunt) {
|
|
|
|
|
|
|
|
grunt.initConfig({
|
|
|
|
pkg: grunt.file.readJSON('package.json'),
|
|
|
|
concat: {
|
2014-07-04 19:17:19 +02:00
|
|
|
options: {
|
|
|
|
process: function(src, filepath) {
|
2014-10-31 17:26:22 +01:00
|
|
|
var basepath = filepath.substring(7, filepath.lastIndexOf('/') + 1);
|
|
|
|
// Fix relative paths for css files
|
2014-07-04 19:17:19 +02:00
|
|
|
if(filepath.indexOf('.css', filepath.length - 4) !== -1) {
|
2014-10-31 17:26:22 +01:00
|
|
|
return src.replace(/(url\s*[\("']+)\s*([^'"\)]+)(['"\)]+;?)/gi, function(match, start, url, end, offset, string) {
|
|
|
|
if(url.indexOf('data:') === 0) {
|
|
|
|
// Skip data urls
|
|
|
|
return match;
|
2014-11-02 18:58:08 +01:00
|
|
|
|
2014-10-31 17:26:22 +01:00
|
|
|
} else if(url.indexOf('/') === 0) {
|
|
|
|
// Skip absolute urls
|
|
|
|
return match;
|
2014-11-02 18:58:08 +01:00
|
|
|
|
2014-10-31 17:26:22 +01:00
|
|
|
} else {
|
|
|
|
return start + basepath + url + end;
|
|
|
|
}
|
|
|
|
});
|
2014-11-02 18:58:08 +01:00
|
|
|
|
2014-10-31 17:26:22 +01:00
|
|
|
// Fix source maps locations
|
|
|
|
} else if(filepath.indexOf('.js', filepath.length - 4) !== -1) {
|
|
|
|
return src.replace(/(\/[*\/][#@]\s*sourceMappingURL=)([^\s]+)/gi, function(match, start, url, offset, string) {
|
|
|
|
if(url.indexOf('/') === 0) {
|
|
|
|
// Skip absolute urls
|
|
|
|
return match;
|
2014-11-02 18:58:08 +01:00
|
|
|
|
2014-10-31 17:26:22 +01:00
|
|
|
} else {
|
|
|
|
return start + basepath + url;
|
|
|
|
}
|
|
|
|
});
|
2014-11-02 18:58:08 +01:00
|
|
|
|
2014-07-04 19:17:19 +02:00
|
|
|
// Don't do anything for unknown file types
|
|
|
|
} else {
|
|
|
|
return src;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
2014-04-28 22:05:37 +02:00
|
|
|
js: {
|
|
|
|
src: [
|
|
|
|
'public/vendor/jquery/dist/jquery.js',
|
2014-10-01 02:47:56 +02:00
|
|
|
'public/vendor/jquery-ui/jquery-ui.min.js',
|
2014-04-28 22:05:37 +02:00
|
|
|
'public/vendor/bootstrap/dist/js/bootstrap.min.js',
|
|
|
|
'public/vendor/datatables/media/js/jquery.dataTables.js',
|
|
|
|
'public/vendor/datatables-bootstrap3/BS3/assets/js/datatables.js',
|
|
|
|
'public/vendor/knockout.js/knockout.js',
|
|
|
|
'public/vendor/knockout-mapping/build/output/knockout.mapping-latest.js',
|
|
|
|
'public/vendor/knockout-sortable/build/knockout-sortable.min.js',
|
|
|
|
'public/vendor/underscore/underscore.js',
|
|
|
|
'public/vendor/bootstrap-datepicker/js/bootstrap-datepicker.js',
|
|
|
|
'public/vendor/typeahead.js/dist/typeahead.min.js',
|
|
|
|
'public/vendor/accounting/accounting.min.js',
|
2014-04-29 22:46:40 +02:00
|
|
|
'public/vendor/spectrum/spectrum.js',
|
2014-06-16 00:13:31 +02:00
|
|
|
'public/vendor/jspdf/dist/jspdf.min.js',
|
2014-10-01 02:47:56 +02:00
|
|
|
'public/vendor/handsontable/dist/jquery.handsontable.full.min.js',
|
2014-11-12 16:22:54 +01:00
|
|
|
'public/js/lightbox.min.js',
|
|
|
|
'public/js/bootstrap-combobox.js',
|
2014-04-28 22:05:37 +02:00
|
|
|
'public/js/script.js',
|
|
|
|
],
|
2014-07-04 19:17:19 +02:00
|
|
|
dest: 'public/built.js',
|
|
|
|
nonull: true
|
2014-10-12 20:11:41 +02:00
|
|
|
},
|
|
|
|
js_public: {
|
|
|
|
src: [
|
|
|
|
'public/js/simpleexpand.js',
|
|
|
|
'public/js/valign.js',
|
|
|
|
'public/js/bootstrap.min.js',
|
2014-10-20 22:30:48 +02:00
|
|
|
'public/js/simpleexpand.js',
|
2014-10-12 20:11:41 +02:00
|
|
|
],
|
|
|
|
dest: 'public/js/built.public.js',
|
|
|
|
nonull: true
|
2014-04-28 22:05:37 +02:00
|
|
|
},
|
|
|
|
css: {
|
|
|
|
src: [
|
|
|
|
'public/vendor/bootstrap/dist/css/bootstrap.min.css',
|
|
|
|
'public/vendor/datatables/media/css/jquery.dataTables.css',
|
|
|
|
'public/vendor/datatables-bootstrap3/BS3/assets/css/datatables.css',
|
|
|
|
'public/vendor/font-awesome/css/font-awesome.min.css',
|
|
|
|
'public/vendor/bootstrap-datepicker/css/datepicker.css',
|
2014-04-29 22:46:40 +02:00
|
|
|
'public/vendor/spectrum/spectrum.css',
|
2014-04-28 22:05:37 +02:00
|
|
|
'public/css/bootstrap-combobox.css',
|
|
|
|
'public/css/typeahead.js-bootstrap.css',
|
2014-11-12 16:22:54 +01:00
|
|
|
'public/css/lightbox.css',
|
2014-10-01 02:47:56 +02:00
|
|
|
'public/vendor/handsontable/dist/jquery.handsontable.full.css',
|
2014-04-28 22:05:37 +02:00
|
|
|
'public/css/style.css',
|
2014-07-04 19:17:19 +02:00
|
|
|
],
|
|
|
|
dest: 'public/built.css',
|
|
|
|
nonull: true
|
2014-04-28 22:05:37 +02:00
|
|
|
},
|
|
|
|
css_public: {
|
|
|
|
src: [
|
|
|
|
'public/vendor/bootstrap/dist/css/bootstrap.min.css',
|
|
|
|
'public/css/bootstrap.splash.css',
|
|
|
|
'public/css/splash.css',
|
2014-11-12 22:09:42 +01:00
|
|
|
'public/vendor/datatables/media/css/jquery.dataTables.css',
|
|
|
|
'public/vendor/datatables-bootstrap3/BS3/assets/css/datatables.css',
|
2014-04-28 22:05:37 +02:00
|
|
|
],
|
2014-07-04 19:17:19 +02:00
|
|
|
dest: 'public/built.public.css',
|
|
|
|
nonull: true
|
2014-04-28 22:05:37 +02:00
|
|
|
}
|
|
|
|
}
|
2014-07-04 19:17:19 +02:00
|
|
|
});
|
2014-04-28 22:05:37 +02:00
|
|
|
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-concat');
|
|
|
|
|
|
|
|
grunt.registerTask('default', ['concat']);
|
|
|
|
|
2014-07-04 19:17:19 +02:00
|
|
|
};
|