websch/gulpfile.js

75 lines
1.7 KiB
JavaScript
Raw Permalink Normal View History

2020-08-02 10:26:22 +00:00
const gulp = require('gulp');
const concat = require('gulp-concat');
const useref = require('gulp-useref');
const replace = require('gulp-replace');
const cachebust = require('gulp-cache-bust');
const minify = require('gulp-minify');
gulp.task('css', function () {
return gulp.src('src/css/*.css')
.pipe(concat('all.css'))
.pipe(gulp.dest('dist'));
});
gulp.task('js', function () {
return gulp.src(['src/js/*.js', 'src/lib/*.js'])
.pipe(concat('all.js'))
.pipe(gulp.dest('dist'));
});
2021-06-02 16:55:24 +00:00
gulp.task('loading', function () {
return gulp.src('src/js/loading.js')
.pipe(gulp.dest('dist'));
});
2020-08-02 10:26:22 +00:00
gulp.task('index', function () {
2021-06-02 16:55:24 +00:00
return gulp.src('src/*.html')
.pipe(useref())
.pipe(cachebust({type: 'timestamp'}))
.pipe(gulp.dest('dist'));
2020-08-02 10:26:22 +00:00
});
// no service worker implemented yet
gulp.task('cache', function(){
2021-06-02 16:55:24 +00:00
return gulp.src(['./src/serviceworker.js'])
2020-08-02 10:26:22 +00:00
.pipe(replace('<timestamp>', Date.now()))
.pipe(gulp.dest('./dist/'));
});
gulp.task('manifest', function(){
2021-06-02 16:55:24 +00:00
return gulp.src(['./src/site.webmanifest'])
2020-08-02 10:26:22 +00:00
.pipe(gulp.dest('./dist/'));
});
gulp.task('images', function(){
2021-06-02 16:55:24 +00:00
return gulp.src(['src/images/**/*'])
2020-08-02 10:26:22 +00:00
.pipe(gulp.dest('dist/images'));
});
gulp.task('extensions', function(){
2021-06-02 16:55:24 +00:00
return gulp.src(['src/extensions/**/*'])
2020-08-02 10:26:22 +00:00
.pipe(gulp.dest('dist/extensions'));
});
gulp.task('shapelib', function(){
2021-06-02 16:55:24 +00:00
return gulp.src(['src/shapelib/**/*'])
2020-08-02 10:26:22 +00:00
.pipe(gulp.dest('dist/shapelib'));
});
gulp.task('canvg', function(){
2021-06-02 16:55:24 +00:00
return gulp.src(['src/js/lib/canvg.js', 'src/js/lib/rgbcolor.js'])
2020-08-02 10:26:22 +00:00
.pipe(gulp.dest('dist/js/lib'));
});
2021-06-02 16:55:24 +00:00
gulp.task('build',
gulp.series(
'css',
'js',
'index',
'manifest',
'images',
'extensions',
'shapelib',
'canvg'
)
2020-08-02 10:26:22 +00:00
);