mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2024-12-12 23:46:22 +00:00
21f39dff9d
Updated axios to v0.18.1. Also added its source map. Updated lazyload to v12.0.0. Also added its source map. Added bulma's source map. --- Moved fontello.css from public/libs/fontello to src/libs/fontello, to make use of CSS builder. Updated thumbnails styling to properly make sure the thumbnails are displayed as 200x200 (their actual configured dimension). Added fixes to some flexbox's bugs that affect IE 10/11. The safe should display much better in those browsers now. Show files' expiry dates in thumbs view. Updated global error handlers in home.js. I will do similar setup with dashboard.js in the future. Just not now, I'm tired. Only load renders after API request to /api/check has been initiated. Used native lazyloading on album pages' nojs version. Removed unnecessary is-expanded class. Rephrased max upload size disclaimer in nojs uploader page. Bumped v1 and v3 version strings.
123 lines
2.6 KiB
JavaScript
123 lines
2.6 KiB
JavaScript
const gulp = require('gulp')
|
|
const cssnano = require('cssnano')
|
|
const del = require('del')
|
|
const buble = require('gulp-buble')
|
|
const eslint = require('gulp-eslint')
|
|
const gulpif = require('gulp-if')
|
|
const nodemon = require('gulp-nodemon')
|
|
const postcss = require('gulp-postcss')
|
|
const postcssPresetEnv = require('postcss-preset-env')
|
|
const sourcemaps = require('gulp-sourcemaps')
|
|
const stylelint = require('gulp-stylelint')
|
|
const terser = require('gulp-terser')
|
|
|
|
/** TASKS: LINT */
|
|
|
|
gulp.task('lint:js', () => {
|
|
return gulp.src('./src/**/*.js', {
|
|
ignore: './src/libs/**/*'
|
|
})
|
|
.pipe(eslint())
|
|
.pipe(eslint.failAfterError())
|
|
})
|
|
|
|
gulp.task('lint:css', () => {
|
|
return gulp.src('./src/**/*.css', {
|
|
ignore: './src/libs/**/*'
|
|
})
|
|
.pipe(stylelint())
|
|
})
|
|
|
|
gulp.task('lint', gulp.parallel('lint:js', 'lint:css'))
|
|
|
|
/** TASKS: CLEAN */
|
|
|
|
gulp.task('clean:css', () => {
|
|
return del([
|
|
'./dist/**/*.css',
|
|
'./dist/**/*.css.map'
|
|
])
|
|
})
|
|
|
|
gulp.task('clean:js', () => {
|
|
return del([
|
|
'./dist/**/*.js',
|
|
'./dist/**/*.js.map'
|
|
])
|
|
})
|
|
|
|
gulp.task('clean:rest', () => {
|
|
return del([
|
|
'./dist/*'
|
|
])
|
|
})
|
|
|
|
gulp.task('clean', gulp.parallel('clean:css', 'clean:js', 'clean:rest'))
|
|
|
|
/** TASKS: BUILD */
|
|
|
|
gulp.task('build:css', () => {
|
|
const plugins = [
|
|
postcssPresetEnv()
|
|
]
|
|
|
|
// Minify on production
|
|
if (process.env.NODE_ENV !== 'development')
|
|
plugins.push(cssnano())
|
|
|
|
return gulp.src('./src/**/*.css')
|
|
.pipe(sourcemaps.init())
|
|
.pipe(postcss(plugins))
|
|
.pipe(sourcemaps.write('.'))
|
|
.pipe(gulp.dest('./dist'))
|
|
})
|
|
|
|
gulp.task('build:js', () => {
|
|
return gulp.src('./src/**/*.js')
|
|
.pipe(sourcemaps.init())
|
|
.pipe(buble())
|
|
// Minify on production
|
|
.pipe(gulpif(process.env.NODE_ENV !== 'development', terser()))
|
|
.pipe(sourcemaps.write('.'))
|
|
.pipe(gulp.dest('./dist'))
|
|
})
|
|
|
|
gulp.task('build', gulp.parallel('build:css', 'build:js'))
|
|
|
|
gulp.task('default', gulp.series('lint', 'clean', 'build'))
|
|
|
|
/** TASKS: WATCH (SKIP LINTER) */
|
|
|
|
gulp.task('watch:css', () => {
|
|
return gulp.watch([
|
|
'src/**/*.css'
|
|
], gulp.series('clean:css', 'build:css'))
|
|
})
|
|
|
|
gulp.task('watch:js', () => {
|
|
return gulp.watch([
|
|
'src/**/*.js'
|
|
], gulp.series('clean:js', 'build:js'))
|
|
})
|
|
|
|
gulp.task('watch:src', gulp.parallel('watch:css', 'watch:js'))
|
|
|
|
gulp.task('nodemon', done => {
|
|
return nodemon({
|
|
script: './lolisafe.js',
|
|
env: process.env,
|
|
watch: [
|
|
'lolisafe.js',
|
|
'logger.js',
|
|
'config.js',
|
|
'controllers/',
|
|
'database/',
|
|
'routes/'
|
|
],
|
|
ext: 'js',
|
|
done
|
|
})
|
|
})
|
|
|
|
gulp.task('watch', gulp.series('clean', 'build', gulp.parallel('watch:src', 'nodemon')))
|