forked from codesandbox/codesandbox-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gulpfile.js
46 lines (38 loc) · 1.23 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
const gulp = require('gulp');
const postcss = require('gulp-postcss');
const autoprefixer = require('autoprefixer');
const cssnano = require('cssnano');
const rev = require('gulp-rev');
const replace = require('gulp-replace');
const runSequence = require('run-sequence');
const config = require('./config/paths');
gulp.task('css', function() {
return gulp
.src('src/homepage/**/*.css')
.pipe(postcss([autoprefixer, cssnano]))
.pipe(rev())
.pipe(gulp.dest(`${config.appBuild}/`))
.pipe(rev.manifest())
.pipe(gulp.dest(`${config.appBuild}/`));
});
gulp.task('javascript', function() {
return gulp
.src('src/homepage/**/*.js')
.pipe(gulp.dest(`${config.appBuild}/`));
});
gulp.task('html', function() {
const manifest = require(`${config.appBuild}/rev-manifest.json`);
return gulp
.src('src/homepage/index.html')
.pipe(replace('static/css/main.css', manifest['static/css/main.css']))
.pipe(gulp.dest(`${config.appBuild}/`));
});
gulp.task('static', function() {
return gulp
.src(`${config.staticPath}/**/*`)
.pipe(gulp.dest(`${config.appBuild}/`));
});
gulp.task('build', function(cb) {
return runSequence(['css', 'javascript', 'static'], 'html', cb);
});
gulp.task('default', ['build']);