80 lines
2.5 KiB
JavaScript
80 lines
2.5 KiB
JavaScript
|
|
module.exports = function(grunt) {
|
|
|
|
// Project configuration.
|
|
grunt.initConfig({
|
|
pkg: grunt.file.readJSON('package.json'),
|
|
watch: {
|
|
sitecss: {
|
|
files: 'app/assets/less/**/*.less',
|
|
tasks: 'less:dev'
|
|
}
|
|
},
|
|
less: {
|
|
dev: {
|
|
files: {
|
|
'public/css/application.min.css': 'app/assets/less/application.less'
|
|
}
|
|
},
|
|
production: {
|
|
options: {
|
|
plugins : [
|
|
new (require('less-plugin-clean-css'))({compatibility:'ie8'})
|
|
]
|
|
},
|
|
files: {
|
|
'public/css/application.min.css': 'app/assets/less/application.less'
|
|
}
|
|
}
|
|
},
|
|
uglify: {
|
|
options: {},
|
|
jquery: {
|
|
files: {
|
|
'public/js/jquery-3.0.0.min.js' : [
|
|
'node_modules/jquery/dist/jquery.js'
|
|
]
|
|
}
|
|
},
|
|
bootstrap: {
|
|
files: {
|
|
'public/js/bootstrap.min.js': [
|
|
'app/assets/js/bootstrap/tooltip.js',
|
|
'app/assets/js/bootstrap/affix.js',
|
|
'app/assets/js/bootstrap/alert.js',
|
|
'app/assets/js/bootstrap/button.js',
|
|
'app/assets/js/bootstrap/carousel.js',
|
|
'app/assets/js/bootstrap/collapse.js',
|
|
'app/assets/js/bootstrap/dropdown.js',
|
|
'app/assets/js/bootstrap/modal.js',
|
|
'app/assets/js/bootstrap/popover.js',
|
|
'app/assets/js/bootstrap/scrollspy.js',
|
|
'app/assets/js/bootstrap/tab.js',
|
|
'app/assets/js/bootstrap/transition.js'
|
|
]
|
|
}
|
|
}
|
|
|
|
}
|
|
});
|
|
|
|
// Load grunt plugins.
|
|
grunt.loadNpmTasks('grunt-contrib-watch');
|
|
grunt.loadNpmTasks('grunt-contrib-less');
|
|
grunt.loadNpmTasks('grunt-contrib-uglify');
|
|
|
|
grunt.registerTask('js', ['uglify']);
|
|
|
|
var target = grunt.option('target') || 'dev';
|
|
|
|
console.log("Building for: " + target);
|
|
|
|
grunt.registerTask('less-compile', ['less:' + target]);
|
|
|
|
// Default task(s).
|
|
grunt.registerTask('default', ['less-compile', 'js']);
|
|
|
|
if (target == 'dev') {
|
|
grunt.registerTask('watchless', ['watch:sitecss']);
|
|
}
|
|
};
|