-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgulpfile.js
48 lines (44 loc) · 1.07 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
var gulp=require('gulp');
var path=require('path');
var gutil=require('gulp-util');
var sass=require('gulp-sass');
var sourcemaps=require('gulp-sourcemaps');
var concat=require('gulp-concat');
// var webpack=require('webpack');
var webpackDevServer=require('webpack-dev-server');
gulp.task('compile-scss',()=>{
return gulp.src(path.join(__dirname,'./source/scss/**/*.scss'))
.pipe(sourcemaps.init())
.pipe(sass())
.pipe(concat('build.css'))
.pipe(gulp.dest(path.join(__dirname,'/build/css/')));
});
const webpack_config={
entry:'./main.js',
output:{
//filename:'[hash].js' Better in production for caching
filename:'bundle.js' //better for development
},
watch:true,
devtool:'source-map',
module:{
loaders:[
{
test:/\.js$/,
exclude:'/node_modules',
loader:'babel',
query:{
presets:['es2015','react','stage-0']
}
}
]
}
};
gulp.task('webpack',()=>{
return gulp.src('main.js')
.pipe(webpack(webpack_config))
.pipe(gulp.dest('dist/'));
});
gulp.task('watcher',()=>{
gulp.watch(path.join(__dirname,'./source/scss/**/*.scss'),['compile-scss'])
})