Commit d5492bf9 authored by Van's avatar Van

fixed #12534

parent 5557db18
...@@ -21,38 +21,32 @@ ...@@ -21,38 +21,32 @@
* *
* @author <a href="http://vanessa.b3log.org">Liyuan Li</a> * @author <a href="http://vanessa.b3log.org">Liyuan Li</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.6.1.0, Sep 24, 2018 * @version 1.7.0.0, Oct 2, 2018
*/ */
'use strict' 'use strict'
const gulp = require('gulp') const gulp = require('gulp')
const concat = require('gulp-concat') const concat = require('gulp-concat')
const uglify = require('gulp-uglify') const uglify = require('gulp-uglify')
const cleanCSS = require('gulp-clean-css')
const clean = require('gulp-clean')
const sass = require('gulp-sass') const sass = require('gulp-sass')
const rename = require('gulp-rename') const rename = require('gulp-rename')
const minifycss = require('gulp-minify-css') const minifycss = require('gulp-minify-css')
const gulpSequence = require('gulp-sequence'); const del = require('del')
gulp.task('watch', function () {
gulp.watch('./src/main/webapp/skins/*/css/*.scss', ['sass'])
})
gulp.task('sass', function () { function sassProcess () {
return gulp.src('./src/main/webapp/skins/*/css/*.scss'). return gulp.src('./src/main/webapp/skins/*/css/*.scss').
pipe(sass().on('error', sass.logError)). pipe(sass().on('error', sass.logError)).
pipe(gulp.dest('./src/main/webapp/skins/')) pipe(gulp.dest('./src/main/webapp/skins/'))
}) }
function sassProcessWatch () {
gulp.watch('./src/main/webapp/skins/*/css/*.scss', sassProcess)
}
gulp.task('watch', gulp.series(sassProcessWatch))
gulp.task('compress', function () {
// min css
gulp.src('./src/main/webapp/js/lib/CodeMirrorEditor/codemirror.css').
pipe(cleanCSS()).
pipe(concat('codemirror.min.css')).
pipe(gulp.dest('./src/main/webapp/js/lib/CodeMirrorEditor/'))
function miniAdmin () {
// concat js // concat js
const jsJqueryUpload = [ const jsJqueryUpload = [
'./src/main/webapp/js/lib/jquery/jquery.min.js', './src/main/webapp/js/lib/jquery/jquery.min.js',
...@@ -67,42 +61,48 @@ gulp.task('compress', function () { ...@@ -67,42 +61,48 @@ gulp.task('compress', function () {
'./src/main/webapp/js/lib/CodeMirrorEditor/editor.js', './src/main/webapp/js/lib/CodeMirrorEditor/editor.js',
'./src/main/webapp/js/lib/to-markdown.js', './src/main/webapp/js/lib/to-markdown.js',
'./src/main/webapp/js/lib/highlight.js-9.6.0/highlight.pack.js'] './src/main/webapp/js/lib/highlight.js-9.6.0/highlight.pack.js']
gulp.src(jsJqueryUpload). return gulp.src(jsJqueryUpload).
pipe(uglify({output: {ascii_only:true}})). // https://github.com/b3log/solo/issues/12522 pipe(uglify({output: {ascii_only: true}})).
// https://github.com/b3log/solo/issues/12522
pipe(concat('admin-lib.min.js')). pipe(concat('admin-lib.min.js')).
pipe(gulp.dest('./src/main/webapp/js/lib/compress/')) pipe(gulp.dest('./src/main/webapp/js/lib/compress/'))
}
function miniPjax (){
// concat js // concat js
const jsPjax = [ const jsPjax = [
'./src/main/webapp/js/lib/jquery/jquery-3.1.0.min.js', './src/main/webapp/js/lib/jquery/jquery-3.1.0.min.js',
'./src/main/webapp/js/lib/jquery/jquery.pjax.js', './src/main/webapp/js/lib/jquery/jquery.pjax.js',
'./src/main/webapp/js/lib/nprogress/nprogress.js'] './src/main/webapp/js/lib/nprogress/nprogress.js']
gulp.src(jsPjax). return gulp.src(jsPjax).
pipe(uglify()). pipe(uglify()).
pipe(concat('pjax.min.js')). pipe(concat('pjax.min.js')).
pipe(gulp.dest('./src/main/webapp/js/lib/compress/')) pipe(gulp.dest('./src/main/webapp/js/lib/compress/'))
}) }
gulp.task('build', function () { function scripts () {
// minify css // minify js
gulp.src('./src/main/webapp/skins/*/css/*.css'). return gulp.src('./src/main/webapp/skins/*/js/*.js').
pipe(rename({suffix: '.min'})). pipe(rename({suffix: '.min'})).
pipe(minifycss()). pipe(uglify()).
pipe(gulp.dest('./src/main/webapp/skins/')) pipe(gulp.dest('./src/main/webapp/skins/'))
}
// minify js function styles () {
gulp.src('./src/main/webapp/skins/*/js/*.js'). // minify css
return gulp.src('./src/main/webapp/skins/*/css/*.css').
pipe(rename({suffix: '.min'})). pipe(rename({suffix: '.min'})).
pipe(uglify({preserveComments: 'license'})). pipe(minifycss()).
pipe(gulp.dest('./src/main/webapp/skins/')) pipe(gulp.dest('./src/main/webapp/skins/'))
}) }
gulp.task ('clean', function () {
// clean css
gulp.src('./src/main/webapp/skins/*/css/*.min.css').pipe(clean({force: true}));
// clean js
gulp.src('./src/main/webapp/skins/*/js/*.min.js').pipe(clean({force: true}));
});
function cleanProcess () {
return del([
'./src/main/webapp/skins/*/css/*.min.css',
'./src/main/webapp/skins/*/js/*.min.js'])
}
gulp.task('default', gulpSequence('sass', 'build', 'compress')) gulp.task('default',
\ No newline at end of file gulp.series(cleanProcess, sassProcess, gulp.parallel(scripts, styles),
gulp.parallel(miniPjax, miniAdmin)))
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "gulp watch", "dev": "gulp watch",
"build": "gulp clean && gulp clean && gulp" "build": "gulp"
}, },
"author": "Daniel <dl882509@gmail.com> (http://88250.b3log.org) & Vanessa <v@b3log.org> (http://vanessa.b3log.org)", "author": "Daniel <dl882509@gmail.com> (http://88250.b3log.org) & Vanessa <v@b3log.org> (http://vanessa.b3log.org)",
"maintainers": [ "maintainers": [
...@@ -28,15 +28,14 @@ ...@@ -28,15 +28,14 @@
} }
], ],
"devDependencies": { "devDependencies": {
"gulp": "^3.9.1", "del": "^3.0.0",
"gulp-clean": "^0.4.0", "gulp": "^4.0.0",
"gulp-clean-css": "^2.4.0", "gulp-concat": "^2.6.1",
"gulp-concat": "2.6.0",
"gulp-minify-css": "^1.2.4", "gulp-minify-css": "^1.2.4",
"gulp-rename": "^1.4.0", "gulp-rename": "^1.4.0",
"gulp-sass": "^4.0.1", "gulp-sass": "^4.0.1",
"gulp-sequence": "^1.0.0", "gulp-uglify": "^3.0.1",
"gulp-uglify": "^2.1.2", "marked": "^0.5.1"
"marked": "^0.3.6" },
} "dependencies": {}
} }
...@@ -23,18 +23,18 @@ ...@@ -23,18 +23,18 @@
# #
#### H2 runtime #### #### H2 runtime ####
runtimeDatabase=H2 #runtimeDatabase=H2
jdbc.username=root #jdbc.username=root
jdbc.password= #jdbc.password=
jdbc.driver=org.h2.Driver #jdbc.driver=org.h2.Driver
jdbc.URL=jdbc:h2:~/solo_h2/db #jdbc.URL=jdbc:h2:~/solo_h2/db
#### MySQL runtime #### #### MySQL runtime ####
#runtimeDatabase=MYSQL runtimeDatabase=MYSQL
#jdbc.username=root jdbc.username=root
#jdbc.password=123456 jdbc.password=123456
#jdbc.driver=com.mysql.cj.jdbc.Driver jdbc.driver=com.mysql.cj.jdbc.Driver
#jdbc.URL=jdbc:mysql://localhost:3306/solo?useUnicode=yes&characterEncoding=UTF-8&useSSL=false&serverTimezone=UTC jdbc.URL=jdbc:mysql://localhost:3306/solo?useUnicode=yes&characterEncoding=UTF-8&useSSL=false&serverTimezone=UTC
# The minConnCnt MUST larger or equal to 3 # The minConnCnt MUST larger or equal to 3
jdbc.minConnCnt=5 jdbc.minConnCnt=5
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment