2017-11-08 01:04:59 +05:30
|
|
|
var gulp = require('gulp');
|
|
|
|
// var uglify = require('gulp-uglify');
|
|
|
|
// var minifyCSS = require('gulp-csso');
|
|
|
|
var useref = require('gulp-useref');
|
|
|
|
|
2017-11-19 23:47:02 +05:30
|
|
|
gulp.task('css', function() {
|
|
|
|
return gulp
|
|
|
|
.src([
|
|
|
|
'src/lib/codemirror/lib/codemirror.css',
|
|
|
|
'src/lib/codemirror/addon/hint/show-hint.css',
|
|
|
|
'src/lib/codemirror/addon/fold/foldgutter.css',
|
|
|
|
'src/lib/hint.min.css',
|
|
|
|
'src/lib/inlet.css',
|
|
|
|
'src/style.css'
|
|
|
|
])
|
|
|
|
.pipe(concat('build.css'))
|
|
|
|
.pipe(minifyCSS())
|
|
|
|
.pipe(gulp.dest('src'));
|
2017-11-08 01:04:59 +05:30
|
|
|
});
|
|
|
|
|
2017-11-19 23:47:02 +05:30
|
|
|
gulp.task('useRef', [], function() {
|
|
|
|
return gulp.src('src/index.html').pipe(useref()).pipe(gulp.dest('app'));
|
2017-11-08 01:04:59 +05:30
|
|
|
});
|
|
|
|
|
2017-11-19 23:47:02 +05:30
|
|
|
gulp.task('generate-service-worker', ['useRef'], function(callback) {
|
|
|
|
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}'
|
|
|
|
],
|
|
|
|
},
|
|
|
|
callback
|
|
|
|
);
|
2017-11-08 01:04:59 +05:30
|
|
|
});
|
|
|
|
|
2017-11-19 23:47:02 +05:30
|
|
|
gulp.task('default', ['generate-service-worker']);
|