forked from w3c/wai-website-theme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
41 lines (37 loc) · 1.19 KB
/
gulpfile.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
41
const gulp = require('gulp');
const postcss = require('gulp-postcss');
const atImport = require('postcss-easy-import');
const postcssPresetEnv = require('postcss-preset-env');
const cssnano = require('gulp-cssnano');
const sourcemaps = require('gulp-sourcemaps');
var pixrem = require('gulp-pixrem');
const csssource = "_css/style.css";
const processors = [
atImport({glob: true}),
postcssPresetEnv({
stage: 0,
features: {
'nesting-rules': true,
'custom-media-queries': true,
'media-query-ranges': true,
'custom-selectors': true
},
autoprefixer: {grid:false},
overrideBrowserslist: 'last 2 version, > 1%, IE 10'
})
];
gulp.task('css', function () {
return gulp.src(csssource)
.pipe(sourcemaps.init())
.pipe(postcss(processors))
.pipe(pixrem({ rootValue: '16px' }))
.pipe(cssnano({safe: true}))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('assets/css/'));
});
gulp.task('watch', function() {
var watcher = gulp.watch(['_css/**/*.css', '_components/**/*.css'], ['css']);
watcher.on('change', function(event) {
console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
});
});