|
|
@ -4,11 +4,11 @@
|
|
|
|
/* eslint-disable unicorn/prefer-module */
|
|
|
|
/* eslint-disable unicorn/prefer-module */
|
|
|
|
|
|
|
|
|
|
|
|
const browserSync = require('browser-sync').create()
|
|
|
|
const browserSync = require('browser-sync').create()
|
|
|
|
const cleanCss = require('gulp-clean-css')
|
|
|
|
|
|
|
|
const del = require('del')
|
|
|
|
const del = require('del')
|
|
|
|
const esbuild = require('esbuild')
|
|
|
|
const esbuild = require('esbuild')
|
|
|
|
const { ESLint } = require('eslint')
|
|
|
|
|
|
|
|
const { src, dest, lastRun, watch, series } = require('gulp')
|
|
|
|
const { src, dest, lastRun, watch, series } = require('gulp')
|
|
|
|
|
|
|
|
const cleanCss = require('gulp-clean-css')
|
|
|
|
|
|
|
|
const eslint = require('gulp-eslint7')
|
|
|
|
const fileinclude = require('gulp-file-include')
|
|
|
|
const fileinclude = require('gulp-file-include')
|
|
|
|
const npmDist = require('gulp-npm-dist')
|
|
|
|
const npmDist = require('gulp-npm-dist')
|
|
|
|
const postcss = require('gulp-postcss')
|
|
|
|
const postcss = require('gulp-postcss')
|
|
|
@ -140,12 +140,10 @@ const ts = () => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Lint TS
|
|
|
|
// Lint TS
|
|
|
|
async function lintTs() {
|
|
|
|
const lintTs = () => {
|
|
|
|
const eslint = new ESLint()
|
|
|
|
return src([paths.src.ts + '/**/*.ts'], { since: lastRun(lintTs) })
|
|
|
|
const results = await eslint.lintFiles([paths.src.ts + '/**/*.ts'])
|
|
|
|
.pipe(eslint())
|
|
|
|
const formatter = await eslint.loadFormatter('stylish')
|
|
|
|
.pipe(eslint.format())
|
|
|
|
const resultText = formatter.format(results)
|
|
|
|
|
|
|
|
console.log(resultText)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const index = () => {
|
|
|
|
const index = () => {
|
|
|
@ -190,9 +188,8 @@ const serve = () => {
|
|
|
|
server: paths.temp.base
|
|
|
|
server: paths.temp.base
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
watch([paths.src.scss], series(scss))
|
|
|
|
watch([paths.src.scss], series(lintScss, scss))
|
|
|
|
watch([paths.src.scss], series(lintScss))
|
|
|
|
watch([paths.src.ts], series(lintTs, ts))
|
|
|
|
watch([paths.src.ts], series(ts))
|
|
|
|
|
|
|
|
watch([paths.src.html, paths.src.base + '*.html', paths.src.partials], series(html, index))
|
|
|
|
watch([paths.src.html, paths.src.base + '*.html', paths.src.partials], series(html, index))
|
|
|
|
watch([paths.src.assets], series(assets))
|
|
|
|
watch([paths.src.assets], series(assets))
|
|
|
|
watch([paths.src.vendor], series(vendor))
|
|
|
|
watch([paths.src.vendor], series(vendor))
|
|
|
@ -204,7 +201,7 @@ const minifyDistCss = () => {
|
|
|
|
paths.dist.css + '/**/*.css'
|
|
|
|
paths.dist.css + '/**/*.css'
|
|
|
|
], { base: paths.dist.css })
|
|
|
|
], { base: paths.dist.css })
|
|
|
|
.pipe(sourcemaps.init({ loadMaps: true }))
|
|
|
|
.pipe(sourcemaps.init({ loadMaps: true }))
|
|
|
|
.pipe(cleanCss())
|
|
|
|
.pipe(cleanCss({ format: { breakWith: 'lf' } }))
|
|
|
|
.pipe(rename({ suffix: '.min' }))
|
|
|
|
.pipe(rename({ suffix: '.min' }))
|
|
|
|
.pipe(sourcemaps.write('.'))
|
|
|
|
.pipe(sourcemaps.write('.'))
|
|
|
|
.pipe(dest(paths.dist.css))
|
|
|
|
.pipe(dest(paths.dist.css))
|
|
|
@ -235,9 +232,12 @@ const cleanDist = () => {
|
|
|
|
return del([paths.dist.base])
|
|
|
|
return del([paths.dist.base])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Compile and copy scss/css
|
|
|
|
// Compile and copy all scss/css
|
|
|
|
const copyDistCss = () => {
|
|
|
|
const copyDistCssAll = () => {
|
|
|
|
return src([paths.src.scss + '/adminlte.scss'])
|
|
|
|
return src([
|
|
|
|
|
|
|
|
paths.src.scss + '/adminlte.scss',
|
|
|
|
|
|
|
|
paths.src.scss + '/dark/*.scss'
|
|
|
|
|
|
|
|
], { base: paths.src.scss })
|
|
|
|
.pipe(wait(500))
|
|
|
|
.pipe(wait(500))
|
|
|
|
.pipe(sourcemaps.init())
|
|
|
|
.pipe(sourcemaps.init())
|
|
|
|
.pipe(sass(sassOptions).on('error', sass.logError))
|
|
|
|
.pipe(sass(sassOptions).on('error', sass.logError))
|
|
|
@ -246,21 +246,8 @@ const copyDistCss = () => {
|
|
|
|
.pipe(dest(paths.dist.css))
|
|
|
|
.pipe(dest(paths.dist.css))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const copyDistCssDark = () => {
|
|
|
|
|
|
|
|
return src([paths.src.scss + '/dark/*.scss'])
|
|
|
|
|
|
|
|
.pipe(wait(500))
|
|
|
|
|
|
|
|
.pipe(sourcemaps.init())
|
|
|
|
|
|
|
|
.pipe(sass(sassOptions).on('error', sass.logError))
|
|
|
|
|
|
|
|
.pipe(postcss(postcssOptions))
|
|
|
|
|
|
|
|
.pipe(sourcemaps.write('.'))
|
|
|
|
|
|
|
|
.pipe(dest(paths.dist.css + '/dark'))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const copyDistCssRtl = () => {
|
|
|
|
const copyDistCssRtl = () => {
|
|
|
|
return src([
|
|
|
|
return src(paths.dist.css + '/**/*.css')
|
|
|
|
paths.dist.css + '/*.css',
|
|
|
|
|
|
|
|
paths.dist.css + '/dark/*.css'
|
|
|
|
|
|
|
|
])
|
|
|
|
|
|
|
|
.pipe(wait(500))
|
|
|
|
.pipe(wait(500))
|
|
|
|
.pipe(sourcemaps.init({ loadMaps: true }))
|
|
|
|
.pipe(sourcemaps.init({ loadMaps: true }))
|
|
|
|
.pipe(postcss(postcssRtlOptions))
|
|
|
|
.pipe(postcss(postcssRtlOptions))
|
|
|
@ -318,7 +305,7 @@ const copyDistVendor = () => {
|
|
|
|
.pipe(dest(paths.dist.vendor))
|
|
|
|
.pipe(dest(paths.dist.vendor))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
exports.build = series(lintScss, lintTs, cleanDist, copyDistCss, copyDistCssDark, copyDistCssRtl, minifyDistCss, copyDistJs, minifyDistJs, copyDistHtml, copyDistHtmlIndex, copyDistAssets, copyDistVendor)
|
|
|
|
exports.build = series(lintScss, lintTs, cleanDist, copyDistCssAll, copyDistCssRtl, minifyDistCss, copyDistJs, minifyDistJs, copyDistHtml, copyDistHtmlIndex, copyDistAssets, copyDistVendor)
|
|
|
|
|
|
|
|
|
|
|
|
// Default
|
|
|
|
// Default
|
|
|
|
exports.default = series(lintScss, scss, lintTs, ts, html, index, assets, vendor, serve)
|
|
|
|
exports.default = series(lintScss, scss, lintTs, ts, html, index, assets, vendor, serve)
|
|
|
|