Skip to content

Instantly share code, notes, and snippets.

@dendeffe
Created June 23, 2016 11:50
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 dendeffe/73a2673bfefccb005169de961b8a9391 to your computer and use it in GitHub Desktop.
Save dendeffe/73a2673bfefccb005169de961b8a9391 to your computer and use it in GitHub Desktop.
module.exports = function(grunt) {
// 1. All configuration goes here
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
sass: {
files: ['*.{scss,sass}'],
tasks: ['sass:dist','postcss:dist']
},
livereload: {
files: ['*.html', '*.php', '*.js', '*.{css,scss}','img/**/*.{png,jpg,jpeg,gif,webp,svg}'],
options: {
livereload: true
}
}
},
sass: {
options: {
sourceMap: true
},
dist: {
files: {
'style_pre.css': 'style.scss',
'editor-style.css': 'editor-style.scss'
}
}
},
postcss: {
options: {
map: true,
processors: [
require('autoprefixer')({
browsers: ['last 2 versions']
})
]
},
dist: {
src: 'style_pre.css',
dest: 'style.css'
}
}
});
// 3. Where we tell Grunt we plan to use this plug-in.
grunt.loadNpmTasks('grunt-sass');
grunt.loadNpmTasks('grunt-postcss');
grunt.loadNpmTasks('grunt-contrib-watch');
// 4. Where we tell Grunt what to do when we type "grunt" into the terminal.
grunt.registerTask('default', ['sass:dist', 'postcss:dist', 'watch']);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment