代码拉取完成,页面将自动刷新
/*
* Symphony - A modern community (forum/BBS/SNS/blog) platform written in Java.
* Copyright (C) 2012-2019, b3log.org & hacpai.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* @file frontend tool.
*
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.8.0.1, Feb 11, 2019
*/
'use strict'
var gulp = require('gulp')
var concat = require('gulp-concat')
var cleanCSS = require('gulp-clean-css')
var uglify = require('gulp-uglify')
var sass = require('gulp-sass')
var rename = require('gulp-rename')
var del = require('del')
function sassProcess () {
return gulp.src('./src/main/webapp/scss/*.scss').
pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError)).
pipe(gulp.dest('./src/main/webapp/css'))
}
function sassProcessWatch () {
gulp.watch('./src/main/webapp/scss/*.scss', sassProcess)
}
gulp.task('watch', gulp.series(sassProcessWatch))
function cleanProcess () {
return del(['./src/main/webapp/js/*.min.js'])
}
function minArticleCSS () {
// min article css
return gulp.src([
'./src/main/webapp/js/lib/vditor-0.2.5/index.classic.css',
'./src/main/webapp/js/lib/highlight/styles/github.css',
'./src/main/webapp/js/lib/diff2html/diff2html.min.css']).
pipe(cleanCSS()).
pipe(concat('article.min.css')).
pipe(gulp.dest('./src/main/webapp/js/lib/compress/'))
}
function minJS () {
// min js
return gulp.src('./src/main/webapp/js/*.js').
pipe(uglify()).
pipe(rename({suffix: '.min'})).
pipe(gulp.dest('./src/main/webapp/js/'))
}
function minUpload () {
// concat js
var jsJqueryUpload = [
'./src/main/webapp/js/lib/jquery/file-upload-9.10.1/vendor/jquery.ui.widget.js',
'./src/main/webapp/js/lib/jquery/file-upload-9.10.1/jquery.iframe-transport.js',
'./src/main/webapp/js/lib/jquery/file-upload-9.10.1/jquery.fileupload.js',
'./src/main/webapp/js/lib/jquery/file-upload-9.10.1/jquery.fileupload-process.js',
'./src/main/webapp/js/lib/jquery/file-upload-9.10.1/jquery.fileupload-validate.js']
return gulp.src(jsJqueryUpload).
pipe(uglify()).
pipe(concat('jquery.fileupload.min.js')).
pipe(gulp.dest('./src/main/webapp/js/lib/jquery/file-upload-9.10.1/'))
}
function minLibs () {
var jsCommonLib = [
'./src/main/webapp/js/lib/jquery/jquery-3.1.0.min.js',
'./src/main/webapp/js/lib/md5.js',
'./src/main/webapp/js/lib/reconnecting-websocket.min.js',
'./src/main/webapp/js/lib/jquery/jquery.bowknot.min.js',
'./src/main/webapp/js/lib/ua-parser.min.js',
'./src/main/webapp/js/lib/jquery/jquery.hotkeys.js',
'./src/main/webapp/js/lib/jquery/jquery.pjax.js',
'./src/main/webapp/js/lib/nprogress/nprogress.js']
return gulp.src(jsCommonLib).
pipe(uglify()).
pipe(concat('libs.min.js')).
pipe(gulp.dest('./src/main/webapp/js/lib/compress/'))
}
function minArticleLibs () {
var jsArticleLib = [
'./src/main/webapp/js/lib/vditor-0.2.5/index.min.js',
'./src/main/webapp/js/lib/highlight/highlight.pack.js',
'./src/main/webapp/js/lib/sound-recorder/SoundRecorder.js',
'./src/main/webapp/js/lib/jquery/jquery.qrcode.min.js',
'./src/main/webapp/js/lib/aplayer/APlayer.min.js',
'./src/main/webapp/js/lib/diff2html/diff2html.min.js',
'./src/main/webapp/js/lib/diff2html/diff2html-ui.min.js',
'./src/main/webapp/js/lib/diff2html/diff.min.js']
return gulp.src(jsArticleLib).
pipe(uglify()).
pipe(concat('article-libs.min.js')).
pipe(gulp.dest('./src/main/webapp/js/lib/compress/'))
}
gulp.task('default',
gulp.series(cleanProcess, sassProcess,
gulp.parallel(minJS, minUpload, minLibs), gulp.parallel(minArticleCSS, minArticleLibs)))
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。