-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
56 lines (47 loc) · 1.6 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
// GULP
var gulp = require('gulp');
var gutil = require("gulp-util");
var sass = require('gulp-sass');
var autoprefixer = require('gulp-autoprefixer');
var cssmin = require('gulp-cssmin');
var rename = require('gulp-rename');
var sourcemaps = require('gulp-sourcemaps');
// WebPack
var WebpackDevServer = require("webpack-dev-server");
var webpack = require("webpack");
var webpackConfig = require("./webpack.config.js");
var stream = require('webpack-stream');
var assets = {
scss: ['./stylesheet/**/*.scss']
};
// GULP:STYLES
gulp.task('styles', function () {
return gulp.src( './stylesheet/style.scss' )
.pipe( sourcemaps.init())
.pipe( sass( { includePaths: ['./stylesheet/components/'], outputStyle: 'expanded'} ) )
.pipe( autoprefixer('last 2 versions') )
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest('./css/'))
// .pipe(stream(webpackConfig))
// .pipe(cssmin())
// .pipe( gulp.dest( './src/sass/') )
// .pipe( connect.reload() );
});
gulp.task('watch', function() {
gulp.watch( assets.scss, ['styles'] );
});
// GULP:WEBPACK DEV SERVER
gulp.task('webpack-dev-server', function() {
// content
var wpConfig = Object.create(webpackConfig);
new WebpackDevServer(webpack(wpConfig), {
publicPath: "/" + wpConfig.output.publicPath,
stats: {
colors:true
}
}).listen(8000, "localhost", function(err) {
if (err) throw new gutil.PluginError("webpack-dev-server", err);
gutil.log("[webpack-dev-server]", "http://localhost:8080/index.html");
});
});
gulp.task('default',['webpack-dev-server', 'styles', 'watch']);