Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Gruntfile that I use for projects
// http://gruntjs.com/configuring-tasks#building-the-files-object-dynamically
module.exports = function(grunt) {
/**
* Saves having to declare each dependency
*/
require( "matchdep" ).filterDev( "grunt-*" ).forEach( grunt.loadNpmTasks );
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
options: {
compress: true,
mangle: true,
report: 'min',
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
},
build: {
files: {
"js/all.min.js": ["js/libs/zepto-1.0.1.js", "js/plugins/*.js", "js/main.js"]
}
}
},
sass: {
build: {
files: {
'css/global.min.css': 'css/global.scss'
},
options: {
style: 'expanded'
}
}
},
watch: {
scripts: {
files: ['js/**/*.js', 'js/main.js'],
tasks: ['uglify'],
options: {
spawn: false
}
},
css: {
files: ['css/**/*.scss'],
tasks: ['sass']
},
styles: {
files: ['css/global.min.css'],
tasks: ['autoprefixer', 'cssmin'],
options: {
spawn: false
}
}
},
cssmin: {
minify: {
expand: true,
cwd: 'css/',
src: ['global.min.css'],
dest: 'css/',
ext: '.min.css'
}
},
autoprefixer: {
dist: {
files: {
'css/global.min.css': 'css/global.min.css'
}
}
},
imagemin: {
png: {
options: {
optimizationLevel: 7
},
files: [
{
// Set to true to enable the following options…
expand: true,
// cwd is 'current working directory'
cwd: 'images/',
src: ['*.png'],
// Could also match cwd line above. i.e. project-directory/img/
dest: 'images/',
ext: '.png'
}
]
},
jpg: {
options: {
progressive: true
},
files: [
{
// Set to true to enable the following options…
expand: true,
// cwd is 'current working directory'
cwd: 'images/',
src: ['*.jpg'],
// Could also match cwd. i.e. project-directory/img/
dest: 'images/',
ext: '.jpg'
}
]
}
}
});
};
{
"name": "project-name",
"version": "0.1.0",
"repository": {
"type": "git",
"url": ""
},
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-uglify": "~0.2.4",
"grunt-contrib-imagemin": "~0.1.4",
"grunt-contrib-sass": "*",
"grunt-contrib-watch": "~0.5.3",
"matchdep": "*",
"grunt-autoprefixer": "*",
"grunt-contrib-cssmin": "*"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.