-
Notifications
You must be signed in to change notification settings - Fork 82
/
Copy pathgulpfile.js
43 lines (35 loc) · 974 Bytes
/
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
42
43
'use strict';
const {src, dest, watch} = require('gulp');
const sass = require('gulp-sass');
const rename = require('gulp-rename');
const postcss = require('gulp-postcss');
const autoprefixer = require('autoprefixer');
const cssnano = require('cssnano');
const sourcemaps = require('gulp-sourcemaps');
const paths = {
srcCSS: './src/scss/**/*',
srcCSSMain: './src/scss/main.scss',
distCSS: './dist/css/'
};
function css() {
let plugins = [
autoprefixer(),
cssnano()
];
return src(paths.srcCSSMain)
.pipe(sass().on('error', sass.logError))
.pipe(sourcemaps.init())
.pipe(sourcemaps.write())
.pipe(dest(paths.distCSS))
.pipe(postcss(plugins))
.pipe(rename((path) => {
path.basename += ".min";
}))
.pipe(dest(paths.distCSS))
}
function looking() {
return watch(paths.srcCSS, css);
}
exports.css = css;
exports.watch = looking;
exports.default = css;