Skip to content

Instantly share code, notes, and snippets.

@Abban
Created November 20, 2013 15:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Abban/7564616 to your computer and use it in GitHub Desktop.
Save Abban/7564616 to your computer and use it in GitHub Desktop.
Grunt Sample file
module.exports = function(grunt)
{
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
sourceDir: 'themes/third_party/tickets',
cpjsFiles: [
'<%= sourceDir %>/js/cp-custom.js',
'<%= sourceDir %>/js/toolbar-tabs.js',
'<%= sourceDir %>/js/chosen.jquery.js',
'<%= sourceDir %>/js/file-upload.js',
'<%= sourceDir %>/js/codemirror/codemirror.js',
'<%= sourceDir %>/js/codemirror/addon/mode/overlay.js',
'<%= sourceDir %>/js/codemirror/mode/markdown/markdown.js',
'<%= sourceDir %>/js/codemirror/mode/gfm/gfm.js'
],
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
},
cp: {
src: 'cp.js',
dest: 'cp.min.js'
}
},
jshint: {
files: ['gruntfile.js', 'jquery-fileupload.js'],
options: {
globals: {
jQuery: true,
console: true,
module: true
}
}
},
concat: {
options: {
stripBanners: true,
separator: ';'
},
cp: {
src: this.cpjsFiles,
dest: '<%= sourceDir %>/js/cp.js'
}
},
sass: {
dist: {
options: {
style: 'expanded'
},
files: {
'<%= sourceDir %>/css/cp.css': '<%= sourceDir %>/scss/cp.scss',
'<%= sourceDir %>/css/stye.css': '<%= sourceDir %>/scss/style.scss'
}
}
},
watch: {
cpScripts: {
files: this.cpjsFiles,
tasks: ['buildcp']
}
},
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.registerTask('default', 'buildcp');
grunt.registerTask('build', ['jshint', 'concat', 'uglify', 'sass']);
grunt.registerTask('buildcp', ['concat:cp'/*, 'uglify:cp', 'sass'*/]);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment