forked from miniMAC/magic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
47 lines (40 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
42
43
44
45
46
47
/**
* Gulp
*
* npm install --save-dev gulp gulp-sass gulp-postcss autoprefixer gulp-rename
*
* @see https://gulpjs.com/
*/
const { src, dest, watch, parallel } = require('gulp');
const sass = require('gulp-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 );