-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
gulpfile.js
47 lines (40 loc) · 1.24 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
42
43
44
45
46
47
/**
* Gulp
*
* npm i --save-dev gulp sass gulp-sass postcss gulp-postcss autoprefixer gulp-rename cssnano gulp-cssnano
*
* @see https://gulpjs.com/
*/
const { src, dest, watch, parallel } = require('gulp');
const sass = require('gulp-sass')(require('sass'));
const postcss = require('gulp-postcss');
const autoprefixer = require('autoprefixer');
const cssnano = require('cssnano');
const rename = require('gulp-rename');
// Define project paths
let paths = {
styles: {
// grab all .scss files from that path
src: 'assets/scss/*.scss',
// destination path
dest: 'dist'
}
};
// SCSS
function style() {
return src(paths.styles.src, { sourcemaps: true })
.pipe(sass().on("error", sass.logError))
.pipe(postcss([ autoprefixer() ]))
.pipe(dest(paths.styles.dest, { sourcemaps: '.' }))
}
function styleMin() {
return src(paths.styles.src, { sourcemaps: true })
.pipe(sass().on("error", sass.logError))
.pipe(postcss([ autoprefixer(), cssnano() ]))
.pipe(rename({ extname: '.min.css' }))
.pipe(dest(paths.styles.dest, { sourcemaps: '.' }));
}
// Watchers
watch('assets/scss/*.scss', style);
// Yo baby!! ✌️
exports.default = parallel( style, styleMin );