-
Notifications
You must be signed in to change notification settings - Fork 7
/
gulpfile.js
52 lines (44 loc) · 1.41 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
/*
* Copyright (c) 2017, Globo.com <https://github.com/globocom/megadraft-table-plugin>
*
* 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");
// The development server (the recommended option for development)
gulp.task("default", ["dev-server"]);
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/styles/**/*.scss", ["demo-sass"]);
gulp.watch("./demo/main.scss", ["demo-sass"]);
});
gulp.task("build", function (callback) {
gulp.start("sass");
});
gulp.task("dev-server", function (callback) {
gulp.start("demo-sass");
gulp.start("demo-watch");
new WebpackDevServer(webpack(webpackConfig), {
stats: {colors: true}
}).listen(8080, "localhost", function (err) {
if (err) {
throw new gutil.PluginError("webpack-dev-server", err);
}
});
});