Created
August 7, 2017 10:18
-
-
Save uknick/138c86b02e70ecc02caa81ca9859b077 to your computer and use it in GitHub Desktop.
gulp setup.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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']); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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