Created
March 7, 2013 21:24
-
-
Save davidosomething/5111930 to your computer and use it in GitHub Desktop.
Gruntfile.js for arn.com's WordPress theme
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
/*global module:false*/ | |
module.exports = function (grunt) { | |
"use strict"; | |
var jsMain = [ | |
'assets/js/adc_casestudies.js', | |
'assets/js/adc_block.js', | |
'assets/js/adc_blocks.js', | |
'assets/js/adc_location.js', | |
'assets/js/adc_jobs.js', | |
'assets/js/adc_navigation.js', | |
'assets/js/script.js' | |
]; | |
var jsPlugins = [ | |
'assets/js/helper.js', | |
'assets/js/jquery.touchclick/jquery.touchclick.min.js', | |
'assets/js/jQuery-URL-Parser/purl.js', | |
'assets/js/isotope/jquery.isotope.min.js', | |
'assets/js/centered_masonry.js', | |
'assets/js/fitvids/jquery.fitvids.js', | |
'assets/js/fittext/jquery.fittext.js', | |
'assets/js/mustache/mustache.js', | |
'assets/js/icanhaz/ICanHaz-no-mustache.min.js' | |
]; | |
grunt.initConfig({ | |
pkg: '<json:package.json>', | |
// JSHINT ////////////////////////////////////////////////////////////////////// | |
jshint: { | |
options: { | |
curly: true, | |
eqeqeq: true, | |
immed: true, | |
indent: 2, | |
latedef: true, | |
newcap: true, | |
noarg: true, | |
sub: true, | |
undef: true | |
}, | |
gruntfile: [ | |
'Gruntfile.js' | |
], | |
arndotcom: jsMain | |
}, | |
// CLEAN /////////////////////////////////////////////////////////////////////// | |
clean: { | |
prod: [ | |
'release/' | |
] | |
}, | |
// CONCAT ////////////////////////////////////////////////////////////////////// | |
concat: { | |
options: { | |
separator: ';' | |
}, | |
dev: { | |
files: { | |
'assets/js/script.min.js': jsMain | |
} | |
} | |
}, | |
// UGLIFY ////////////////////////////////////////////////////////////////////// | |
uglify: { | |
dev: { | |
options: { | |
mangle: false | |
}, | |
files: { | |
'assets/js/plugins.min.js': jsPlugins | |
} | |
}, | |
prod: { | |
files: { | |
'release/assets/js/script.min.js': jsMain, | |
'release/assets/js/plugins.min.js': jsPlugins | |
} | |
} | |
}, | |
// COMPASS ///////////////////////////////////////////////////////////////////// | |
compass: { | |
dev: { | |
options: { | |
environment: 'development', | |
sassDir: 'assets/sass', | |
cssDir: 'assets/css', | |
raw: 'preferred_syntax = :scss\n' | |
} | |
}, | |
prod: { | |
options: { | |
environment: 'production', | |
sassDir: 'assets/sass', | |
cssDir: 'assets/css', | |
raw: 'preferred_syntax = :scss\n' | |
} | |
} | |
}, | |
// IMAGEMIN //////////////////////////////////////////////////////////////////// | |
imagemin: { | |
prod: { | |
expand: true, | |
cwd: 'assets/img', | |
src: '*.{png,jpg,jpeg}', | |
dest: 'release/assets/img/' | |
} | |
}, | |
// COPY //////////////////////////////////////////////////////////////////////// | |
copy: { | |
prod: { | |
files: { | |
'release/assets/': 'assets/**', | |
'release/style.css': 'assets/css/style-prod.css' | |
} | |
}, | |
dev: { | |
files: { | |
'style.css': 'assets/css/style-dev.css' | |
} | |
} | |
}, | |
// WATCH /////////////////////////////////////////////////////////////////////// | |
watch: { | |
gruntfile: { | |
files: 'Gruntfile.js', | |
tasks: ['jshint:gruntfile'], | |
options: { | |
nocase: true | |
} | |
}, | |
js: { | |
files: ['assets/js/*.*'], | |
tasks: ['concat:dev', 'uglify:dev'], | |
options: { | |
nospawn: true | |
} | |
}, | |
sass: { | |
files: ['assets/sass/*.*'], | |
tasks: ['compass:dev', 'copy:dev'], | |
options: { | |
nospawn: true | |
} | |
} | |
} | |
}); | |
// LOAD TASKS ////////////////////////////////////////////////////////////////// | |
grunt.loadNpmTasks('grunt-contrib-clean'); | |
grunt.loadNpmTasks('grunt-contrib-compass'); | |
grunt.loadNpmTasks('grunt-contrib-concat'); | |
grunt.loadNpmTasks('grunt-contrib-copy'); | |
grunt.loadNpmTasks('grunt-contrib-imagemin'); | |
grunt.loadNpmTasks('grunt-contrib-jshint'); | |
grunt.loadNpmTasks('grunt-contrib-uglify'); | |
grunt.loadNpmTasks('grunt-contrib-watch'); | |
// REGISTER TASKS ////////////////////////////////////////////////////////////// | |
grunt.registerTask('dev', [ | |
'jshint', | |
'concat:dev', | |
'uglify:dev', | |
'compass:dev', | |
'copy:dev' | |
]); | |
grunt.registerTask('prod', [ | |
'jshint', | |
'clean:prod', | |
'copy:prod', | |
'uglify:prod', | |
'compass:prod', | |
'imagemin:prod', | |
'copy:prod' | |
]); | |
grunt.registerTask('default', ['jshint']); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment