mirror of
https://github.com/chinchang/web-maker.git
synced 2025-07-17 03:51:13 +02:00
fix sw generation
This commit is contained in:
14
gulpfile.js
14
gulpfile.js
@@ -99,16 +99,20 @@ gulp.task('useRef', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('concatSwRegistration', function () {
|
gulp.task('concatSwRegistration', function () {
|
||||||
|
const bundleFile = fs
|
||||||
|
.readdirSync('app')
|
||||||
|
.filter(allFilesPaths => allFilesPaths.match(/bundle.*\.js$/) !== null)[0];
|
||||||
|
|
||||||
|
console.log('matched', bundleFile);
|
||||||
|
|
||||||
return gulp
|
return gulp
|
||||||
.src(['src/service-worker-registration.js', 'app/script.js'], {
|
.src(['src/service-worker-registration.js', `app/${bundleFile}`])
|
||||||
allowEmpty: true
|
.pipe(concat(bundleFile))
|
||||||
})
|
|
||||||
.pipe(concat('script.js'))
|
|
||||||
.pipe(gulp.dest('app'));
|
.pipe(gulp.dest('app'));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('minify', function () {
|
gulp.task('minify', function () {
|
||||||
minifyJs('app/script.js');
|
// minifyJs('app/script.js');
|
||||||
// minifyJs('app/vendor.js');
|
// minifyJs('app/vendor.js');
|
||||||
minifyJs('app/lib/screenlog.js');
|
minifyJs('app/lib/screenlog.js');
|
||||||
|
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
"description": "A blazing fast & offline web playground",
|
"description": "A blazing fast & offline web playground",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "concurrently --kill-others \"gulp start-preview-server\" \"npm run -s dev\"",
|
"start": "concurrently --kill-others \"gulp start-preview-server\" \"npm run -s dev\"",
|
||||||
"build": "preact build --template src/index.html --prerender false --no-inline-css",
|
"build": "preact build --template src/index.html --prerender false --no-inline-css --sw false --esm false",
|
||||||
"dev": "preact watch --template src/index.html",
|
"dev": "preact watch --template src/index.html",
|
||||||
"serve-website": "cd packages/website; npm start",
|
"serve-website": "cd packages/website; npm start",
|
||||||
"build-website": "cd packages/website; npm run build",
|
"build-website": "cd packages/website; npm run build",
|
||||||
|
Reference in New Issue
Block a user