Skip to content

Instantly share code, notes, and snippets.

@nelsonJM
Created December 6, 2013 21:47
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 nelsonJM/7832678 to your computer and use it in GitHub Desktop.
Save nelsonJM/7832678 to your computer and use it in GitHub Desktop.
Grunt: Gruntfile.js example
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
imagemin: {
static: {
options: {
optimizationLevel: 3
},
files: {
'pbimages/pegboard-2424.jpg': 'img_src/pbimages/pegboard-2424.jpg'
}
}
},
watch: {
css: {
files: ['sass/*.scss'],
tasks: ['compass', 'cssmin']
},
livereload: {
files: ['custom.css', 'salespage.css', 'js/steelsentry-theme.min.js'],
options: { livereload: true }
}
},
compass: {
dist: {
options: {
config: 'config.rb',
force: true
}
}
},
concat: {
options: {
separator: ';'
},
dist: {
src: [ 'js/vendor/ja.placeholder.js','js/colorbox/jquery.colorbox.js'],
dest: 'js/<%= pkg.name %>.js'
},
dist2: {
src: ['Scripts/AC_RunActiveContent.js', 'Scripts/crawler.js', 'flash/swfobject.js'],
dest: 'js/legacy.js'
},
dist3: {
src: ['js/jquery.anythingslider.js', 'js/vendor/ja.placeholder.js', 'js/sales-sliders.js'],
dest: 'js/sales.js'
},
dist4: {
src: ['js/vendor/jquery.validate.js', 'js/jq-validate-start.js'],
dest: 'js/<%= pkg.name %>.validate.js'
},
dist5: {
src: ['js/vendor/sticky.js', 'js/jn_simple_slider/jn_simple_slider.js'],
dest: 'js/<%= pkg.name %>.gallery.js'
},
},
uglify: {
options: {
banner: '/* <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
},
build: {
files: {
'js/<%= pkg.name %>.min.js' : ['js/<%= pkg.name %>.js'],
'js/legacy.min.js' : ['js/legacy.js'],
'js/sales.min.js' : ['js/sales.js'],
'js/<%= pkg.name %>.validate.min.js' : ['js/<%= pkg.name %>.validate.js'],
'js/<%= pkg.name %>.gallery.min.js' : ['js/<%= pkg.name %>.gallery.js']
}
}
},
cssmin: {
compress: {
files: {
'custom.css': ['custom-unmin.css'],
'salespage.css': ['salespage-unmin.css']
}
}
}
});
// Load the plugin that provides the "uglify" talk.
grunt.loadNpmTasks('grunt-contrib-imagemin');
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-watch');
// Default task(s).
grunt.registerTask('default', ['concat','uglify']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment