forked from mboperator/grwlrplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
54 lines (46 loc) · 1.58 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
var
gulp = require('gulp'),
sass = require('gulp-sass'),
cached = require('gulp-cached'),
autoprefixer = require('gulp-autoprefixer'),
minify = require('gulp-minify-css'),
sourcemaps = require('gulp-sourcemaps'),
browserSync = require('browser-sync').create(),
reload = browserSync.reload,
webpack = require('gulp-webpack'),
webpackServer = require('./webpack-server');
var cssPath = "lib/css/**/*.scss";
var cssOutPath = "public/assets/css";
var jsPath = "lib/js/**/*.js";
var jsOutPath = "dist/";
gulp.task('webpack-hot', webpackServer);
gulp.task('browsersync', function() {
browserSync.init({
proxy: '0.0.0.0:8081',
port: 8083
});
gulp.watch(cssPath, ['browsersync-build']);
gulp.watch('public/**/*.html', reload);
});
gulp.task('browsersync-build', function() {
return gulp.src(cssPath)
.pipe(sass({errLogToConsole: true }))
.pipe(cached('styles'))
.pipe(autoprefixer({ browsers: ['last 2 versions']}))
.pipe(gulp.dest(cssOutPath))
.pipe(reload({stream: true}));
});
gulp.task('build_styles', function() {
return gulp.src(cssPath)
.pipe(sass({errLogToConsole: true }))
.pipe(autoprefixer({ browsers: ['last 2 versions']}))
.pipe(minify({compatibility: 'ie9'}))
.pipe(gulp.dest(cssOutPath));
});
gulp.task('build_js', function() {
return gulp.src(jsPath)
.pipe(webpack(require('./webpack.config.js')))
.pipe(gulp.dest(jsOutPath));
});
gulp.task('dev', ['browsersync', 'webpack-hot']);
gulp.task('default', ['build_js', 'build_styles']);