This repository has been archived on 2020-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
quay/grunt/Gruntfile.js

55 lines
1.4 KiB
JavaScript
Raw Normal View History

module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
options: {
process: function(src, filepath) {
var unwraps = ['/js/'];
var shouldWrap = true;
for (var i = 0; i < unwraps.length; ++i) {
if (filepath.indexOf(unwraps[i]) >= 0) {
shouldWrap = false;
break;
}
}
if (shouldWrap) {
return '// Source: ' + filepath + '\n' +
'(function() {\n' + src + '\n})();\n';
} else {
return '// Source: ' + filepath + '\n' + src + '\n\n';
}
},
},
build: {
src: ['../static/lib/**/*.js', '../static/js/*.js', '!../static/lib/jquery.overscroll.min.js'],
dest: '../static/dist/<%= pkg.name %>.js'
}
},
cssmin: {
'../static/dist/<%= pkg.name %>.css': ['../static/lib/**/*.css', '../static/css/*.css']
},
uglify: {
options: {
mangle: false
},
js_min: {
files: {
'../static/dist/<%= pkg.name %>.min.js': ['../static/dist/<%= pkg.name %>.js']
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-cssmin');
// Default task(s).
grunt.registerTask('default', ['concat', 'cssmin', 'uglify']);
};