Skip to content

Instantly share code, notes, and snippets.

@taniarascia
Created October 20, 2015 18:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taniarascia/1a12a744b6f0efff9093 to your computer and use it in GitHub Desktop.
Save taniarascia/1a12a744b6f0efff9093 to your computer and use it in GitHub Desktop.
// Load Grunt
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// Tasks
sass: { // Begin Sass Plugin
dist: {
options: {
sourcemap: 'none'
},
files: [{
expand: true,
cwd: 'sass',
src: ['**/*.scss'],
dest: 'css',
ext: '.css'
}]
}
},
postcss: { // Begin Post CSS Plugin
options: {
map: false,
processors: [
require('autoprefixer')({
browsers: ['last 2 versions']
})
]
},
dist: {
src: 'css/style.css'
}
},
cssmin: { // Begin CSS Minify Plugin
target: {
files: [{
expand: true,
cwd: 'css',
src: ['*.css', '!*.min.css'],
dest: 'css',
ext: '.min.css'
}]
}
},
uglify: { // Begin JS Uglify Plugin
build: {
src: ['src/*.js'],
dest: 'js/script.min.js'
}
},
watch: { // Compile everything into one task with Watch Plugin
css: {
files: '**/*.scss',
tasks: ['sass', 'postcss', 'cssmin']
},
js: {
files: '**/*.js',
tasks: ['uglify']
}
}
});
// Load Grunt plugins
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-postcss');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
// Register Grunt tasks
grunt.registerTask('default', ['watch']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment