mirror of
https://github.com/mxpv/podsync.git
synced 2024-05-11 05:55:04 +00:00
Migrate to gulp 4
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# Build fronend
|
||||
FROM node:8-slim AS frontend_builder
|
||||
FROM node:11-slim AS builder
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
RUN npm install
|
||||
@@ -11,5 +11,5 @@ FROM umputun/nginx-le:latest
|
||||
COPY cmd/nginx/podsync.conf /etc/nginx/service.conf
|
||||
COPY cmd/nginx/robots.txt /var/www/
|
||||
|
||||
COPY --from=frontend_builder /app/templates/ /var/www/
|
||||
COPY --from=frontend_builder /app/dist/ /var/www/assets/
|
||||
COPY --from=builder /app/dist/html/ /var/www/
|
||||
COPY --from=builder /app/dist/assets/ /var/www/assets/
|
||||
|
||||
+21
-14
@@ -12,37 +12,44 @@ var gulp = require('gulp'),
|
||||
|
||||
abs = path.join(process.cwd(), 'assets');
|
||||
|
||||
gulp.task('clean', function () {
|
||||
// Clean up artifacts
|
||||
const clean = function() {
|
||||
return del(['./dist/**/*'])
|
||||
});
|
||||
};
|
||||
|
||||
// Minify images and output to ./dist folder
|
||||
gulp.task('img', ['clean'], function() {
|
||||
const img = function() {
|
||||
return gulp.src('./assets/**/*.{png,ico}')
|
||||
.pipe(imagemin())
|
||||
.pipe(size())
|
||||
.pipe(gulp.dest('./dist'))
|
||||
});
|
||||
.pipe(gulp.dest('./dist/assets/'))
|
||||
};
|
||||
|
||||
// Minify scripts, build manifest.json and output to ./dist folder
|
||||
gulp.task('js+css', ['clean', 'img'], function() {
|
||||
const scripts = function() {
|
||||
return gulp.src(['./assets/js/**/*.js', './assets/css/**/*.css'], {base: abs})
|
||||
.pipe(gulpif(/js$/, uglify()))
|
||||
.pipe(gulpif(/css$/, autoprefixer()))
|
||||
.pipe(gulpif(/css$/, cleancss()))
|
||||
.pipe(rev())
|
||||
.pipe(size())
|
||||
.pipe(gulp.dest('./dist'))
|
||||
.pipe(gulp.dest('./dist/assets'))
|
||||
.pipe(rev.manifest('manifest.json', {merge: true}))
|
||||
.pipe(gulp.dest('./dist'));
|
||||
});
|
||||
.pipe(gulp.dest('./dist/assets'));
|
||||
};
|
||||
|
||||
// Rewrite occurrences of scripts in template files
|
||||
gulp.task('patch', ['js+css'], function() {
|
||||
var manifest = gulp.src('./dist/manifest.json');
|
||||
const patch = function() {
|
||||
var manifest = gulp.src('./dist/assets/manifest.json');
|
||||
return gulp.src('./templates/index.html')
|
||||
.pipe(revreplace({manifest: manifest}))
|
||||
.pipe(gulp.dest('./templates/'))
|
||||
});
|
||||
.pipe(gulp.dest('./dist/html/'))
|
||||
};
|
||||
|
||||
gulp.task('default', ['js+css']);
|
||||
exports.default = gulp.series(
|
||||
clean,
|
||||
gulp.parallel(
|
||||
img,
|
||||
gulp.series(scripts, patch)
|
||||
),
|
||||
);
|
||||
Generated
+1625
-289
File diff suppressed because it is too large
Load Diff
+2
-2
@@ -6,7 +6,7 @@
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"del": "^3.0.0",
|
||||
"gulp": "^3.9.1",
|
||||
"gulp": "^4.0.0",
|
||||
"gulp-autoprefixer": "^4.0.0",
|
||||
"gulp-clean-css": "^3.7.0",
|
||||
"gulp-if": "^2.0.2",
|
||||
@@ -17,7 +17,7 @@
|
||||
"gulp-uglify": "^3.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "gulp -v && gulp patch",
|
||||
"build": "gulp -v && gulp",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
|
||||
Reference in New Issue
Block a user