2018-01-13 14:54:49 +05:30
|
|
|
/*eslint-env node*/
|
|
|
|
|
2017-11-08 01:04:59 +05:30
|
|
|
var gulp = require('gulp');
|
|
|
|
var useref = require('gulp-useref');
|
|
|
|
|
2018-01-13 14:54:49 +05:30
|
|
|
gulp.task('copyFiles', [], function() {
|
|
|
|
gulp.src('src/lib/codemirror/theme/*').pipe(gulp.dest('app/lib/codemirror/theme'));
|
|
|
|
gulp.src('src/lib/codemirror/mode/**/*').pipe(gulp.dest('app/lib/codemirror/mode'));
|
|
|
|
gulp.src('src/partials/*').pipe(gulp.dest('app/partials'));
|
|
|
|
gulp.src('src/lib/screenlog.js').pipe(gulp.dest('app/lib'));
|
|
|
|
gulp.src('src/icon-48.png').pipe(gulp.dest('app'));
|
|
|
|
gulp.src([ 'src/FiraCode.ttf', 'src/Fixedsys.ttf', 'src/Inconsolata.ttf', 'src/Monoid.ttf' ]).pipe(gulp.dest('app'));
|
2017-11-08 01:04:59 +05:30
|
|
|
});
|
|
|
|
|
2018-01-13 14:54:49 +05:30
|
|
|
gulp.task('useRef', [ 'copyFiles' ], function() {
|
2017-11-19 23:47:02 +05:30
|
|
|
return gulp.src('src/index.html').pipe(useref()).pipe(gulp.dest('app'));
|
2017-11-08 01:04:59 +05:30
|
|
|
});
|
|
|
|
|
2018-01-13 14:54:49 +05:30
|
|
|
gulp.task('generate-service-worker', [ 'useRef' ], function(callback) {
|
2017-11-19 23:47:02 +05:30
|
|
|
var swPrecache = require('sw-precache');
|
|
|
|
var rootDir = 'app';
|
2017-11-08 01:04:59 +05:30
|
|
|
|
2017-11-19 23:47:02 +05:30
|
|
|
swPrecache.write(
|
|
|
|
`${rootDir}/service-worker.js`,
|
|
|
|
{
|
|
|
|
staticFileGlobs: [
|
|
|
|
rootDir + '/**/*.{js,html,css,png,jpg,gif,svg,eot,ttf,woff}'
|
|
|
|
],
|
2017-11-20 00:25:54 +05:30
|
|
|
stripPrefix: `${rootDir}/`
|
2017-11-19 23:47:02 +05:30
|
|
|
},
|
|
|
|
callback
|
|
|
|
);
|
2017-11-08 01:04:59 +05:30
|
|
|
});
|
|
|
|
|
2017-11-19 23:47:02 +05:30
|
|
|
gulp.task('default', ['generate-service-worker']);
|