Skip to content

Instantly share code, notes, and snippets.

@bearded-avenger
Last active January 2, 2016 21:29
Show Gist options
  • Save bearded-avenger/8363476 to your computer and use it in GitHub Desktop.
Save bearded-avenger/8363476 to your computer and use it in GitHub Desktop.
CG Cookie GruntFile
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "css"
sass_dir = "sass"
images_dir = "images"
javascripts_dir = "js"
fonts_dir = "fonts"
output_style = :compressed
relative_assets = true
line_comments = false
color_output = false
# If you prefer the indented syntax, you might want to regenerate this
# project again passing --syntax sass, or you can uncomment this:
# preferred_syntax = :sass
# and then run:
# sass-convert -R --from scss --to sass assets/scss scss && rm -rf sass && mv scss sass
preferred_syntax = :scss
'use strict';
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
grunt.initConfig({
// watch our project for changes
watch: {
compass: {
files: ['sass/*.{scss,sass}'],
tasks: ['compass']
},
js: {
files: [
'<%= jshint.all %>'
],
tasks: ['jshint', 'uglify']
},
livereload: {
options: { livereload: true },
files: ['stylesheets/master.css', 'js/*.js', '**/*.html', '**/*.php', 'images/**/*.{png,jpg,jpeg,gif,webp,svg}']
}
},
// image optimization
imagemin: {
dist: {
options: {
optimizationLevel: 7,
progressive: true
},
files: [{
expand: true,
cwd: 'images/',
src: '**/*',
dest: 'images/'
}]
}
},
// style (Sass) compilation via Compass
compass: {
dist: {
options: {
config: 'config.rb',
force: true
}
}
},
// make sure js is clean
jshint: {
options: {
"bitwise": true,
"browser": true,
"curly": true,
"eqeqeq": true,
"eqnull": true,
"es5": true,
"esnext": true,
"immed": true,
"jquery": true,
"latedef": true,
"newcap": true,
"noarg": true,
"node": true,
"strict": false,
"trailing": true,
"undef": true,
"globals": {
"jQuery": true,
"alert": true
}
},
all: [
'Gruntfile.js',
'js/*.js'
]
},
// concatenation and minification all in one
uglify: {
plugins: {
options: {
sourceMap: 'js/plugins.js.map',
sourceMappingURL: 'plugins.js.map',
sourceMapPrefix: 2
},
files: {
'js/plugins.min.js': [
'js/plugins.js',
'js/jquery-validation/jquery.validate.min.js',
'js/html5.js',
'js/modernizr-cgc.js',
'js/pretty/jquery.prettyPhoto.js',
'js/jquery.anchor.js',
'js/tooltip.js',
'js/chosen/chosen.jquery.min.js',
'js/jquery.fitvids.js',
'js/view.min.js'
]
}
}
}
});
// register task
grunt.registerTask('default', ['watch']);
};
{
"name": "cgcookie-4.0",
"version": "0.1.0",
"dependencies": {
"load-grunt-tasks": "~0.2.1"
},
"devDependencies": {
"grunt": "~0.4.2",
"grunt-contrib-compass": "~0.7.0",
"grunt-contrib-imagemin": "~0.4.0",
"grunt-contrib-jshint": "~0.8.0",
"grunt-contrib-uglify": "~0.2.7",
"grunt-contrib-watch": "~0.5.3"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment