-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
54 lines (49 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
48
49
50
51
52
53
54
let gulp = require("gulp");
let sass = require("gulp-sass");
let autoprefixer = require("gulp-autoprefixer");
let concat = require("gulp-concat");
let uglify = require('gulp-uglify-es').default;
let csso = require('gulp-csso');
let rename = require('gulp-rename');
var paths = {
styles: {
src: "assets/css/src/**/*.scss",
dest: "assets/css/dist"
},
scripts: {
src: "assets/js/src/**/*.js",
dest: "assets/js/dist"
}
};
function style() {
return (
gulp
.src(paths.styles.src)
.pipe(concat('tinyDrawer.scss'))
.pipe(sass())
.on("error", sass.logError)
.pipe(autoprefixer())
.pipe(gulp.dest(paths.styles.dest))
.pipe(csso())
.pipe(rename({extname: '.min.css'}))
.pipe(gulp.dest(paths.styles.dest))
);
}
function script() {
return (
gulp
.src(paths.scripts.src)
.pipe(concat('tinyDrawer.js'))
.pipe(gulp.dest(paths.scripts.dest))
.pipe(uglify())
.pipe(rename({extname: '.min.js'}))
.pipe(gulp.dest(paths.scripts.dest))
);
}
function watch(){
gulp.watch(paths.styles.src, style);
gulp.watch(paths.scripts.src, script);
}
exports.style = style;
exports.script = script;
exports.watch = watch;