-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
66 lines (56 loc) · 1.48 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
const { parallel, series, watch, src, dest } = require('gulp');
const $ = require('gulp-load-plugins')();
const cssnano = require('cssnano');
const autoprefixer = require('autoprefixer');
const browserSync = require('browser-sync').create();
function css() {
return src('app/sass/main.scss')
.pipe($.sourcemaps.init())
.pipe($.sass.sync({
outputStyle: 'expanded'
}).on('error', $.sass.logError))
.pipe(dest('app/css'))
.pipe($.rename({
suffix: '.min'
}))
.pipe($.postcss([autoprefixer({
cascade: false
})]))
.pipe($.sass.sync({
outputStyle: 'compressed'
}).on('error', $.sass.logError))
.pipe($.sourcemaps.write('.'))
.pipe(dest('app/css'))
}
// Concat js files (unused yet)
function js() {
return src('assets/js/**/*.js')
.pipe($.concat('main.js'))
.pipe(dest('app/js'))
}
// Put everythin in a dist folder
function copy() {
return src('app/**/*', {base: './app'})
.pipe(dest("dist"))
}
function reload(done) {
browserSync.reload();
done();
}
function serve() {
browserSync.init({
port: 5000,
proxy: 'http://localhost/mta/auth/authentication'
});
}
function watchFiles() {
watch('assets/scss/**/*.scss', css);
}
const dev = parallel(watchFiles, css);
const build = series(css, js, copy);
exports.css = css;
exports.js = js;
exports.copy = copy;
exports.serve = serve;
exports.dev = dev;
exports.build = build;