Skip to content

Instantly share code, notes, and snippets.

@Bobz-zg
Last active August 29, 2015 14:04
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 Bobz-zg/b94b0558403c3434afe1 to your computer and use it in GitHub Desktop.
Save Bobz-zg/b94b0558403c3434afe1 to your computer and use it in GitHub Desktop.
Gruntfile.js file for Roots 7.0.0. using SASS + Compass
'use strict';
module.exports = function(grunt) {
// Load all tasks
require('load-grunt-tasks')(grunt);
// Show elapsed time
require('time-grunt')(grunt);
var jsFileList = [
'assets/vendor/bootstrap-sass/js/transition.js',
'assets/vendor/bootstrap-sass/js/alert.js',
'assets/vendor/bootstrap-sass/js/button.js',
'assets/vendor/bootstrap-sass/js/carousel.js',
'assets/vendor/bootstrap-sass/js/collapse.js',
'assets/vendor/bootstrap-sass/js/dropdown.js',
'assets/vendor/bootstrap-sass/js/modal.js',
'assets/vendor/bootstrap-sass/js/tooltip.js',
'assets/vendor/bootstrap-sass/js/popover.js',
'assets/vendor/bootstrap-sass/js/scrollspy.js',
'assets/vendor/bootstrap-sass/js/tab.js',
'assets/vendor/bootstrap-sass/js/affix.js',
'assets/vendor/jquery-selectboxit/src/javascripts/jquery.selectBoxIt.js',
'assets/js/plugins/*.js',
'assets/js/_*.js'
];
grunt.initConfig({
jshint: {
options: {
jshintrc: '.jshintrc'
},
all: [
'Gruntfile.js',
'assets/js/*.js',
'!assets/js/scripts.js',
'!assets/**/*.min.*'
]
},
compass: {
production: {
options: {
config: 'config.rb',
outputStyle: 'compressed'
},
},
development: {
options: {
config: 'config.rb',
}
}
},
concat: {
options: {
separator: ';',
},
dist: {
src: [jsFileList],
dest: 'assets/js/scripts.js',
},
},
uglify: {
dist: {
files: {
'assets/js/scripts.min.js': [jsFileList]
}
}
},
modernizr: {
build: {
devFile: 'assets/vendor/modernizr/modernizr.js',
outputFile: 'assets/js/vendor/modernizr.min.js',
files: {
'src': [
['assets/js/scripts.min.js'],
['assets/css/main.css']
]
},
uglify: true,
parseFiles: true
}
},
version: {
default: {
options: {
format: true,
length: 32,
manifest: 'assets/manifest.json',
querystring: {
style: 'roots_css',
script: 'roots_js'
}
},
files: {
'lib/scripts.php': 'assets/{css,js}/{main,scripts}.min.{css,js}'
}
}
},
rename: {
main: {
files: [
{
src: ['assets/css/main.css'],
dest: 'assets/css/main.min.css'
},
]
}
},
watch: {
compass: {
files: ['**/*.{scss,sass}'],
tasks: ['compass:development'],
},
js: {
files: [
jsFileList,
'<%= jshint.all %>'
],
tasks: ['jshint', 'concat']
},
livereload: {
// Browser live reloading
// https://github.com/gruntjs/grunt-contrib-watch#live-reloading
options: {
livereload: true
},
files: [
'assets/css/main.css',
'assets/js/scripts.js',
'woocommerce/**/*.php',
'woocommerce/*.php',
'templates/*.php',
'*.php'
]
}
}
});
// Register tasks
grunt.registerTask('default', [
'dev'
]);
grunt.registerTask('dev', [
'jshint',
'compass:development',
'concat'
]);
grunt.registerTask('build', [
'concat',
'jshint',
'compass:production',
'uglify',
'modernizr',
'version',
'rename'
]);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment