-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
50 lines (42 loc) · 1.13 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
var gulp = require('gulp')
var gulpWebpack = require('gulp-webpack')
var webpack = require('webpack')
var autoprefixer = require('autoprefixer-core')
var dest = 'dist/'
var isWatching = false
gulp.task('assets', function() {
return gulp.src('public/**/*.*')
.pipe(gulp.dest(dest))
})
gulp.task('webpack', function() {
return gulp.src('app/app.js')
.pipe(gulpWebpack({
watch: isWatching,
entry: {
app: './app/app.js'
},
output: {
filename: "[name].js"
},
module: {
loaders: [
{ test: /\.css$/, loader: "style-loader!css-loader!postcss-loader" },
{ test: /\.js$/, loader: 'jsx-loader?harmony' }
]
},
postcss: [autoprefixer({browsers: ['last 2 versions']})],
resolve: {
extensions: ['', '.js']
},
plugins: [new webpack.optimize.DedupePlugin()]
}))
.pipe(gulp.dest(dest))
})
gulp.task('setWatch', function() {
isWatching = true
})
gulp.task('watch', function() {
return gulp.watch('public/**/*.*', ['assets'])
})
gulp.task('build', ['assets', 'webpack'])
gulp.task('default', ['setWatch', 'build', 'watch'])