forked from chenyong/vue-pages-workflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
32 lines (27 loc) · 827 Bytes
/
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
var fs = require('fs');
var gulp = require('gulp');
var path = require('path');
var settings = require('./configs/settings');
var taskRender = require('./configs/task-render');
gulp.task('del', function(cb) {
var del = require('del');
del(['build/**/*']).then(paths => {
if (paths.length > 0) {
console.log('Deleted files and folders:');
console.log(paths.join('\n'));
}
cb();
});
});
gulp.task('build-html', taskRender);
gulp.task('dev-html', function(cb) {
var template = fs.readFileSync('./configs/index.html', 'utf8');
var entry1 = '<meta id="entry-1"/>';
var entry2 = '<meta id="entry-2"/>';
var html = template
.replace(entry1, '')
.replace(entry2,
`<script src="http://localhost:8080/main.js"></script>`
);
fs.writeFileSync(`./build/index.html`, html);
});