Last active
August 29, 2015 14:17
-
-
Save Adriench/c1da050c8d216ae2ee20 to your computer and use it in GitHub Desktop.
Gruntfile.js example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(grunt) { | |
// Project configuration. | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
concat: { | |
options: { | |
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n' | |
}, | |
basic: { | |
src: [ 'vendor/modernizr/modernizr.js', // Modernizr | |
'vendor/jquery/dist/jquery.min.js', // jQuery | |
'vendor/bootstrap-sass-official/assets/javascripts/bootstrap.js', // Bootstrap | |
'vendor/gsap/src/minified/TimelineMax.min.js', // GSAP | |
'vendor/scrollmagic/scrollmagic/minified/ScrollMagic.min.js', // Scroll Magic | |
'vendor/scrollmagic/scrollmagic/minified/plugins/animation.gsap.min.js', // Scroll Magic plugin | |
'js/src/*.js' // All the js we wrote | |
], | |
dest: 'js/common.js' | |
}, | |
specialIE8: { | |
src: [ 'vendor/modernizr/modernizr.js', // Modernizr | |
'vendor/jquery/dist/jquery.min.js', // jQuery | |
'vendor/bootstrap-sass-official/assets/javascripts/bootstrap.js', // Bootstrap | |
'vendor/gsap/src/minified/TimelineMax.min.js', // GSAP | |
'vendor/scrollmagic/scrollmagic/minified/ScrollMagic.min.js', // Scroll Magic | |
'vendor/scrollmagic/scrollmagic/minified/plugins/animation.gsap.min.js', // Scroll Magic plugin | |
'js/src/*.js' // All the js we wrote | |
], | |
dest: 'js/commonIE8.js' | |
} | |
}, | |
uglify: { | |
options: { | |
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n' | |
}, | |
basic: { | |
src: 'js/common.js', | |
dest: 'js/common.min.js' | |
}, | |
specialIE8: { | |
src: 'js/commonIE8.js', | |
dest: 'js/commonIE8.min.js' | |
} | |
}, | |
sass: { | |
dist: { | |
options: { | |
compass: true, | |
style: 'expanded', | |
sourcemap: 'none' | |
}, | |
files: { | |
'css/common.css': 'sass/common.scss', | |
'css/commonIE8.css': 'sass/commonIE8.scss' | |
} | |
} | |
}, | |
delta: { | |
scss : { | |
files : [ | |
'sass/**/*' | |
], | |
tasks : ['sass'] | |
}, | |
js : { | |
files : [ | |
'js/src/*.js' | |
], | |
tasks : ['concat'] | |
} | |
} | |
}); | |
// Load the plugins that provides the tasks. | |
grunt.loadNpmTasks('grunt-contrib-watch'); | |
grunt.loadNpmTasks('grunt-contrib-concat'); | |
grunt.loadNpmTasks('grunt-contrib-uglify'); | |
grunt.loadNpmTasks('grunt-contrib-sass'); | |
// Default task(s). | |
grunt.registerTask('build', ['concat:basic', 'concat:specialIE8', 'uglify:basic', 'uglify:specialIE8', 'sass']); | |
grunt.renameTask('watch', 'delta'); | |
grunt.registerTask('watch', ['build', 'delta']); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment