-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
47 lines (40 loc) · 1.38 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
/*
* Copyright (c) 2016, Globo.com (https://github.com/globocom)
*
* License: MIT
*/
var gulp = require("gulp");
var gutil = require("gulp-util");
var sass = require("gulp-sass");
var autoprefixer = require("gulp-autoprefixer");
var webpack = require("webpack");
var WebpackDevServer = require("webpack-dev-server");
var webpackConfig = require("./webpack.config.demo.js");
gulp.task("sass", function () {
return gulp.src("./src/styles/**/*.scss")
.pipe(sass.sync({outputStyle: "expanded"}).on("error", sass.logError))
.pipe(autoprefixer())
.pipe(gulp.dest("./dist/css"));
});
gulp.task("demo-sass", function () {
return gulp.src("./demo/main.scss")
.pipe(sass.sync().on("error", sass.logError))
.pipe(autoprefixer())
.pipe(gulp.dest("./demo"));
});
gulp.task("demo-watch", function () {
gulp.watch("./src/sass/**/*.scss", gulp.series("demo-sass"));
gulp.watch("./demo/main.scss", gulp.series("demo-sass"));
});
gulp.task("build", gulp.series("sass"));
gulp.task("dev-server", gulp.parallel("demo-sass","demo-watch", function (callback) {
new WebpackDevServer(webpack(webpackConfig), {
stats: {colors: true}
}).listen(8080, "localhost", function (err) {
if (err) {
throw new gutil.PluginError("webpack-dev-server", err);
}
});
}));
// The development server (the recommended option for development)
gulp.task("default", gulp.parallel("dev-server"));