Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Grunt file for: Preprocessing sass/compass Watching for changes in the sass/compass file minifying js and sass files concatenating js files
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
compass: {
dist: {
options: {
sassDir: 'sass',
cssDir: 'css',
environment: 'production'
}
}
},
watch: {
css: {
files: '**/*.scss',
tasks: ['compass'],
options: {
livereload: false,
},
},
},
cssmin: {
minify: {
expand: true,
cwd: 'css/',
src: ['*.css', '!*.min.css'],
dest: 'css/min',
ext: '.min.css'
}
},
uglify: {
options: {
mangle: {
except: ['jQuery']
}
},
my_target: {
files: {
'js/min/main.min.js': ['js/script.js', 'js/plugins.js']
}
}
}
});
// Load the plugins
//On github: https://github.com/gruntjs/grunt-contrib-compass
//Install: npm install grunt-contrib-compass --save-dev
grunt.loadNpmTasks('grunt-contrib-compass');
//On github: https://github.com/gruntjs/grunt-contrib-watch
//Install: npm install grunt-contrib-watch --save-dev
grunt.loadNpmTasks('grunt-contrib-watch');
//On github: https://github.com/gruntjs/grunt-contrib-uglify
//Install: npm install grunt-contrib-uglify --save-dev
grunt.loadNpmTasks('grunt-contrib-uglify');
//On github: https://github.com/gruntjs/grunt-contrib-cssmin
//Install: npm install grunt-contrib-cssmin --save-dev
grunt.loadNpmTasks('grunt-contrib-cssmin');
// Default task(s).
grunt.registerTask('default', ['compass', 'cssmin', 'uglify']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment