use webpack instead
This commit is contained in:
parent
93077c083f
commit
d9940a0462
1318
package-lock.json
generated
1318
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
15
package.json
15
package.json
@ -8,13 +8,11 @@
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"css": "mkdir -p build/style && stylus -o build/style src/style/*.styl",
|
||||
"css:watch": "mkdir -p build/style && stylus -w -o build/style src/style/*.styl",
|
||||
"js:main": "mkdir -p build/script && browserify src/script/main.js -o build/script/main.js && uglifyjs --overwrite build/script/main.js",
|
||||
"js:main:watch": "mkdir -p build/script && watchify src/script/main.js -o build/script/main.js",
|
||||
"js:admin": "mkdir -p build/script && browserify src/script/admin.js -o build/script/admin.js && uglifyjs --overwrite build/script/admin.js",
|
||||
"js:admin:watch": "mkdir -p build/script && watchify src/script/admin.js -o build/script/admin.js",
|
||||
"watch": "concurrently --kill-others \"npm run css:watch\" \"npm run js:main:watch\" \"npm run js:admin:watch\"",
|
||||
"js": "webpack",
|
||||
"js:watch": "webpack -w",
|
||||
"watch": "concurrently --kill-others \"npm run css:watch\" \"npm run js:watch\"",
|
||||
"clean": "rm -rf build/",
|
||||
"build": "npm run clean && npm run css && npm run js:main && npm run js:admin"
|
||||
"build": "npm run clean && npm run css && npm run js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -59,15 +57,14 @@
|
||||
"uuid": "^3.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"browserify": "^14.4.0",
|
||||
"concurrently": "^3.5.0",
|
||||
"eslint-plugin-import": "^2.7.0",
|
||||
"jquery": "^3.2.1",
|
||||
"mustache": "^2.3.0",
|
||||
"standard": "^10.0.3",
|
||||
"uglify-js": "^1.3.5",
|
||||
"uglifyjs-webpack-plugin": "^0.4.6",
|
||||
"watch": "^1.0.2",
|
||||
"watchify": "^3.9.0"
|
||||
"webpack": "^3.6.0"
|
||||
},
|
||||
"standard": {
|
||||
"env": {
|
||||
|
@ -1,9 +1,7 @@
|
||||
import express from 'express'
|
||||
import config from '../../scripts/load-config'
|
||||
import wrap from '../../scripts/asyncRoute'
|
||||
import {User} from '../api'
|
||||
import API from '../api/admin'
|
||||
import News from '../api/news'
|
||||
|
||||
const router = express.Router()
|
||||
const apiRouter = express.Router()
|
||||
|
@ -636,14 +636,11 @@ router.get('/docs/:name', wrap(async (req, res, next) => {
|
||||
return next()
|
||||
}
|
||||
|
||||
try {
|
||||
doc = fs.readFileSync(doc, {encoding: 'utf8'})
|
||||
} catch (e) {
|
||||
return next(e)
|
||||
}
|
||||
|
||||
res.header('Cache-Control', 'max-age=' + 7 * 24 * 60 * 60 * 1000) // 1 week
|
||||
res.render('document', {doc: doc})
|
||||
fs.readFile(doc, {encoding: 'utf8'}, (err, contents) => {
|
||||
if (err) return next(err)
|
||||
res.header('Cache-Control', 'max-age=' + 7 * 24 * 60 * 60 * 1000) // 1 week
|
||||
res.render('document', {doc: contents})
|
||||
})
|
||||
}))
|
||||
|
||||
/*
|
||||
|
16
webpack.config.js
Normal file
16
webpack.config.js
Normal file
@ -0,0 +1,16 @@
|
||||
const path = require('path')
|
||||
const UglifyJSPlugin = require('uglifyjs-webpack-plugin')
|
||||
|
||||
module.exports = {
|
||||
entry: {
|
||||
main: './src/script/main.js',
|
||||
admin: './src/script/admin.js'
|
||||
},
|
||||
output: {
|
||||
path: path.join(__dirname, 'build', 'script'),
|
||||
filename: '[name].js'
|
||||
},
|
||||
plugins: [
|
||||
new UglifyJSPlugin()
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user