-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
75 lines (67 loc) · 2.21 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//Gulp packages ------------------------------------------------------------ //
var gulp = require('gulp');
var postcss = require('gulp-postcss');
var sass = require('gulp-sass')(require('sass'));
var rename = require('gulp-rename')
//PostCSS packages
var cssnano = require('cssnano');
var presetEnv = require('postcss-preset-env');
var lost = require('lost');
//Variables ---------------------------------------------------------------- //
//Processors
var processors = [
lost(),
presetEnv()
];
var distProcessors = processors.concat([(cssnano())]);
//URLs
var paths = {
src: 'src/**',
dest: 'public/css'
};
//Tasks -------------------------------------------------------------------- //
const buildCss = function() {
return gulp.src([srcPath + '/*.css'])
.pipe(postcss(processors))
.pipe(rename({dirname:''}))
.pipe(gulp.dest(paths.src));
};
gulp.task('buildcss', buildCss);
gulp.task('buildCss', buildCss);
const buildCssDist = function() {
return gulp.src([srcPath + '/*.css'])
.pipe(postcss(distProcessors))
.pipe(rename({dirname:''}))
.pipe(gulp.dest(paths.dest));
};
gulp.task('buildcssdist', buildCssDist);
gulp.task('buildCssDist', buildCssDist);
const buildSass = function() {
return gulp.src([paths.src + '/*.scss'])
.pipe(sass().on('error', sass.logError))
.pipe(postcss(processors))
.pipe(rename({dirname:''}))
.pipe(gulp.dest(paths.dest))
};
gulp.task('buildSass', buildSass);
gulp.task('buildsass', buildSass);
const buildSassDist = function() {
return gulp.src([paths.src + '/*.scss'])
.pipe(sass().on('error', sass.logError))
.pipe(postcss(distProcessors))
.pipe(rename({dirname:''}))
.pipe(gulp.dest(paths.dest))
};
gulp.task('buildSassDist', buildSassDist);
gulp.task('buildsassdist', buildSassDist);
//Watch ---------------------------------------------------------- ---------- //
const watchCss = function(){
gulp.watch(paths.src + '/*.css', gulp.series(['buildCSS']))
};
gulp.task('watchCss', watchCss);
gulp.task('watchcss', watchCss);
const watchSass = function(){
gulp.watch(paths.src + '/*.scss', gulp.series(['buildSASS']))
};
gulp.task('watchSass', watchSass);
gulp.task('watchsass', watchSass);