-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpostcss.js
40 lines (35 loc) · 1.07 KB
/
postcss.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
var gulp = require('gulp'),
path = require('path'),
sass = require('gulp-sass'),
sourcemaps = require('gulp-sourcemaps'),
postcss = require('gulp-postcss'),
cssnext = require('postcss-cssnext'),
assets = require('postcss-assets'),
colorguard = require('gulp-colorguard'),
cssnano = require('gulp-cssnano'),
;
// Define PostCSS tasks
var cssnext = cssnext(config.tasks.css.postcss.cssnext),
assets = assets(config.tasks.css.postcss.assets),
colorguard = colorguard(config.tasks.css.postcss.colorguard),
cssnano = cssnano(config.tasks.css.postcss.cssnano),
postcssConfig = [
cssnext,
assets,
colorguard,
// TODO - Only run cssnano in Prod, not Dev
cssnano
]
;
// CSS
var processCSS = function() {
return gulp.src(paths.src)
.pipe(sourcemaps.init())
.pipe(sass())
.pipe(postcss(postcssConfig))
.pipe(sourcemaps.write())
.pipe(gulp.dest(paths.dest))
;
};
gulp.task('css', processCSS);
module.exports = processCSS;