Skip to content

Instantly share code, notes, and snippets.

@uknick
Created August 7, 2017 10:18
Show Gist options
  • Save uknick/138c86b02e70ecc02caa81ca9859b077 to your computer and use it in GitHub Desktop.
Save uknick/138c86b02e70ecc02caa81ca9859b077 to your computer and use it in GitHub Desktop.
gulp setup.
var
//modules
gulp = require('gulp'),
// css modules
sass = require('gulp-sass'),
postcss = require('gulp-postcss'),
assets = require('postcss-assets'),
autoprefixer = require('autoprefixer'),
mqpacker = require('css-mqpacker'),
cssnano = require('cssnano');
gulp.task('sass', function () {
var postCssOpts = [
autoprefixer({ browsers: ['last 2 versions', '> 2%', 'ie > 7'] }),
mqpacker
];
return gulp.src('scss/**/*')
.pipe(sass({
outputStyle: 'expanded',
precisions: 3,
errLogToConsole: true
})) // Converts Sass to CSS with gulp-sass
.pipe(postcss(postCssOpts))
.pipe(gulp.dest('../css'))
});
gulp.task('watch', function () {
gulp.watch('scss/**/*', ['sass']);
});
{
"name": "",
"version": "1.0.0",
"description": "",
"main": "index.js",
"directories": {
"test": "tests"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"autoprefixer": "^6.7.7",
"css-mqpacker": "^5.0.1",
"cssnano": "^3.10.0",
"gulp": "^3.9.1",
"gulp-postcss": "^6.4.0",
"gulp-sass": "^3.1.0",
"postcss-assets": "^4.1.0",
"srcset": "^1.0.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment