-
Notifications
You must be signed in to change notification settings - Fork 7
/
gulpfile.js
53 lines (46 loc) · 1.45 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
var gulp = require('gulp');
var RevAll = require("gulp-rev-all");
$ = require('gulp-load-plugins')({
camelize: true
});
gulp.task('css', function() {
return gulp.src('app/components/App/app.scss')
.pipe($.sourcemaps.init())
.pipe($.sass().on('error', $.sass.logError))
.pipe($.autoprefixer({
// browsers: ['last 2 versions'],
cascade: false
}))
.pipe($.sourcemaps.write())
.pipe(gulp.dest('./dist'))
})
gulp.task('css:watch', gulp.series(['css'], function() {
gulp.watch('app/**/*.scss', ['css'])
}))
gulp.task('moveAssets', function() {
return gulp.src('./app/assets/**/*')
.pipe(gulp.dest('./dist/assets'))
})
gulp.task('build:revAssets', gulp.series(['css', 'moveAssets'], function() {
// var rev = new $.revAll()
return gulp.src('./dist/**/*')
.pipe(RevAll.revision())
.pipe(gulp.dest('./dist/public'))
.pipe(RevAll.manifestFile())
.pipe(gulp.dest('./dist'))
}))
gulp.task('build:cpServer', function() {
return gulp.src('./app/**/*.{js,jsx,ejs}')
.pipe(gulp.dest('./dist/server-build'))
})
gulp.task('build:revServer', gulp.series(['build:cpServer'], function() {
var manifest = gulp.src('./dist/rev-manifest.json')
return gulp.src('./dist/server-build/{components,containers}/**/*')
.pipe($.revReplace({
manifest: manifest
}))
.pipe(gulp.dest('./dist/server-build'))
}))
gulp.task('build', gulp.series('build:revAssets', 'build:revServer', function (done) {
done();
}));