Skip to content

Instantly share code, notes, and snippets.

@clouddueling
Created December 12, 2013 01:51
Show Gist options
  • Save clouddueling/7921994 to your computer and use it in GitHub Desktop.
Save clouddueling/7921994 to your computer and use it in GitHub Desktop.
my first grunt file.js
//Gruntfile
module.exports = function(grunt) {
//Initializing the configuration object
grunt.initConfig({
// Task configuration
concat: {
options: {
separator: ";\n"
},
javascript: {
src: [
// NOTE Core
'./public/bower/jquery/jquery.min.js',
'./public/bower/jquery-ui/ui/minified/jquery-ui.min.js',
'./public/lib/bootstrap/js/bootstrap.min.js',
'./public/bower/underscore/underscore-min.js',
'./public/bower/momentjs/min/moment.min.js',
// NOTE Angular
'./public/bower/angular/angular.min.js',
'./public/bower/angular-route/angular-route.min.js',
// NOTE Angular UI
'./public/lib/ui-bootstrap/ui-bootstrap-tpls-0.6.0.mod.js',
'./public/bower/angular-ui-date/src/date.js',
'./public/bower/angular-ui-select2/src/select2.js',
'./public/bower/angular-ui-sortable/src/sortable.js',
'./public/bower/angular-ui-utils/modules/keypress/keypress.js',
'./public/bower/angular-ui-router/release/angular-ui-router.min.js',
// NOTE Angular Common
'./public/bower/angular-common/modules/common/common.js',
'./public/bower/angular-common/modules/api/api.js',
'./public/bower/angular-common/modules/drag/drag.js',
'./public/bower/angular-common/modules/confirm/confirm.js',
'./public/bower/angular-common/modules/dateRange/dateRange.js',
'./public/bower/angular-common/modules/mediaelement/mediaelement.js',
'./public/bower/angular-common/modules/modal/modal.js',
'./public/bower/angular-common/modules/ngBindHtmlUnsafe/ngBindHtmlUnsafe.js',
'./public/bower/angular-common/modules/print/print.js',
'./public/bower/angular-common/modules/redactor/redactor.js',
'./public/bower/angular-common/modules/strings/strings.js',
'./public/bower/angular-common/modules/time/time.js',
'./public/bower/angular-common/modules/upload/upload.js',
'./public/bower/angular-common/modules/youtube/youtube.js',
// NOTE Angular Common Dependencies
'./public/lib/jquery-form/jquery.form.js',
'./public/lib/date-range-picker/daterangepicker.js',
'./public/lib/ng-storage/ngStorage.js',
// NOTE Other
'./public/bower/toastr/toastr.min.js',
'./public/bower/select2/select2.min.js',
'./public/bower/lightbox2/js/lightbox-2.6.min.js',
'./public/bower/mediaelement/build/mediaelement-and-player.min.js',
'./public/lib/redactor-9/redactor.js'
],
dest: './public/js/base.js'
}
},
less: {
development: {
options: {
compress: true, //minifying the result
},
files: {
//compiling frontend.less into frontend.css
"./public/css/styles.css": "./public/less/styles.less",
}
}
},
uglify: {
options: {
mangle: false //Use if you want the names of your functions and variables unchanged
},
dist: {
files: {
'./public/js/base.min.js': './public/js/base.js'
}
}
},
phpunit: {
},
watch: {
//js: {
// files: ['./public/apps/**/*.*'], //watched files
/** tasks: ['concat:javascript','uglify'], //tasks to run
options: {
livereload: true //reloads the browser
}
},
*/
less: {
files: ['./public/less/*.*'], //watched files
tasks: ['less'], //tasks to run
options: {
livereload: false //reloads the browser
}
},
}
});
// Plugin loading
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-phpunit');
// Task definition
grunt.registerTask('default', ['watch']);
grunt.registerTask('build', ['concat:javascript', 'uglify', 'less']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment