Browse Source

Mathjax init handling

pull/73/head
NGPixel 7 years ago
parent
commit
b004362aba
6 changed files with 51 additions and 20 deletions
  1. 1
      .gitignore
  2. 8
      client/js/pages/view.js
  3. 4
      client/js/pre-init/mathjax.js
  4. 20
      fuse.js
  5. 34
      package.json
  6. 4
      views/layout.pug

1
.gitignore

@ -25,6 +25,7 @@ newrelic.js
# Fusebox # Fusebox
.fusebox .fusebox
.build
# Config Files # Config Files
config.yml config.yml

8
client/js/pages/view.js

@ -19,8 +19,14 @@ module.exports = (alerts) => {
scale: 120, scale: 120,
font: 'STIX-Web' font: 'STIX-Web'
}, },
showMathMenu: false
tex2jax: {
preview: 'none'
},
showMathMenu: false,
showProcessingMessages: false,
messageStyle: 'none'
}) })
MathJax.Hub.Configured()
require('../modals/create.js')(currentBasePath) require('../modals/create.js')(currentBasePath)
require('../modals/move.js')(currentBasePath, alerts) require('../modals/move.js')(currentBasePath, alerts)

4
client/js/pre-init/mathjax.js

@ -0,0 +1,4 @@
window.MathJax = {
root: '/js/mathjax',
delayStartupUntil: 'configured'
}

20
fuse.js

@ -56,6 +56,10 @@ const ALIASES = {
'vue': 'vue/dist/vue.min.js' 'vue': 'vue/dist/vue.min.js'
} }
const SHIMS = { const SHIMS = {
_preinit: {
source: '.build/_preinit.js',
exports: '_preinit'
},
jquery: { jquery: {
source: 'node_modules/jquery/dist/jquery.js', source: 'node_modules/jquery/dist/jquery.js',
exports: '$' exports: '$'
@ -72,6 +76,7 @@ const SHIMS = {
console.info(colors.white('└── ') + colors.green('Running global tasks...')) console.info(colors.white('└── ') + colors.green('Running global tasks...'))
let preInitContent = ''
let globalTasks = Promise.mapSeries([ let globalTasks = Promise.mapSeries([
/** /**
* ACE Modes * ACE Modes
@ -144,6 +149,20 @@ let globalTasks = Promise.mapSeries([
throw err throw err
} }
}) })
},
/**
* Bundle pre-init scripts
*/
() => {
console.info(colors.white(' └── ') + colors.green('Bundling pre-init scripts...'))
return fs.readdirAsync('./client/js/pre-init').map(f => {
let fPath = path.join('./client/js/pre-init/', f)
return fs.readFileAsync(fPath, 'utf8').then(fContent => {
preInitContent += fContent + ';\n'
})
}).then(() => {
return fs.outputFileAsync('./.build/_preinit.js', preInitContent, 'utf8')
})
} }
], f => { return f() }) ], f => { return f() })
@ -251,6 +270,7 @@ globalTasks.then(() => {
shim: SHIMS, shim: SHIMS,
plugins: [ plugins: [
fsbx.EnvPlugin({ NODE_ENV: 'production' }), fsbx.EnvPlugin({ NODE_ENV: 'production' }),
fsbx.BannerPlugin(preInitContent),
[ fsbx.SassPlugin({ outputStyle: 'compressed', includePaths: ['./node_modules/requarks-core'] }), fsbx.CSSPlugin() ], [ fsbx.SassPlugin({ outputStyle: 'compressed', includePaths: ['./node_modules/requarks-core'] }), fsbx.CSSPlugin() ],
fsbx.BabelPlugin({ fsbx.BabelPlugin({
config: { config: {

34
package.json

@ -41,12 +41,12 @@
"auto-load": "^2.1.0", "auto-load": "^2.1.0",
"axios": "^0.16.1", "axios": "^0.16.1",
"bcryptjs-then": "^1.0.1", "bcryptjs-then": "^1.0.1",
"bluebird": "^3.4.7",
"bluebird": "^3.5.0",
"body-parser": "^1.17.1", "body-parser": "^1.17.1",
"bunyan": "^1.8.9",
"bunyan": "^1.8.10",
"cheerio": "^0.22.0", "cheerio": "^0.22.0",
"child-process-promise": "^2.2.1", "child-process-promise": "^2.2.1",
"chokidar": "^1.6.0",
"chokidar": "^1.6.1",
"commander": "^2.9.0", "commander": "^2.9.0",
"compression": "^1.6.2", "compression": "^1.6.2",
"connect-flash": "^0.1.1", "connect-flash": "^0.1.1",
@ -55,17 +55,17 @@
"cron": "^1.2.1", "cron": "^1.2.1",
"execa": "^0.6.3", "execa": "^0.6.3",
"express": "^4.15.2", "express": "^4.15.2",
"express-brute": "^1.0.0",
"express-brute": "^1.0.1",
"express-brute-mongoose": "0.0.8", "express-brute-mongoose": "0.0.8",
"express-session": "^1.15.2", "express-session": "^1.15.2",
"file-type": "^4.0.0",
"file-type": "^4.1.0",
"filesize.js": "^1.0.2", "filesize.js": "^1.0.2",
"follow-redirects": "^1.2.3", "follow-redirects": "^1.2.3",
"fs-extra": "^2.1.2", "fs-extra": "^2.1.2",
"git-wrapper2-promise": "^0.2.9", "git-wrapper2-promise": "^0.2.9",
"highlight.js": "^9.9.0",
"i18next": "^7.1.3",
"i18next-express-middleware": "^1.0.3",
"highlight.js": "^9.10.0",
"i18next": "^7.2.3",
"i18next-express-middleware": "^1.0.4",
"i18next-node-fs-backend": "^0.1.3", "i18next-node-fs-backend": "^0.1.3",
"image-size": "^0.5.1", "image-size": "^0.5.1",
"jimp": "github:ngpixel/jimp", "jimp": "github:ngpixel/jimp",
@ -73,8 +73,8 @@
"jsonwebtoken": "^7.3.0", "jsonwebtoken": "^7.3.0",
"klaw": "^1.3.1", "klaw": "^1.3.1",
"levelup": "^1.3.5", "levelup": "^1.3.5",
"lodash": "^4.17.3",
"markdown-it": "^8.3.0",
"lodash": "^4.17.4",
"markdown-it": "^8.3.1",
"markdown-it-abbr": "^1.0.4", "markdown-it-abbr": "^1.0.4",
"markdown-it-anchor": "^4.0.0", "markdown-it-anchor": "^4.0.0",
"markdown-it-attrs": "^0.8.0", "markdown-it-attrs": "^0.8.0",
@ -89,8 +89,8 @@
"moment": "^2.18.1", "moment": "^2.18.1",
"moment-timezone": "^0.5.13", "moment-timezone": "^0.5.13",
"mongodb": "^2.2.25", "mongodb": "^2.2.25",
"mongoose": "^4.9.2",
"multer": "^1.2.1",
"mongoose": "^4.9.4",
"multer": "^1.3.0",
"ora": "^1.2.0", "ora": "^1.2.0",
"passport": "^0.3.2", "passport": "^0.3.2",
"passport-azure-ad-oauth2": "0.0.4", "passport-azure-ad-oauth2": "0.0.4",
@ -129,7 +129,7 @@
"brace": "^0.10.0", "brace": "^0.10.0",
"colors": "^1.1.2", "colors": "^1.1.2",
"eslint": "latest", "eslint": "latest",
"eslint-config-standard": "^10.2.0",
"eslint-config-standard": "^10.2.1",
"eslint-plugin-import": "latest", "eslint-plugin-import": "latest",
"eslint-plugin-node": "latest", "eslint-plugin-node": "latest",
"eslint-plugin-promise": "latest", "eslint-plugin-promise": "latest",
@ -139,15 +139,15 @@
"jquery": "^3.2.1", "jquery": "^3.2.1",
"jquery-contextmenu": "^2.4.4", "jquery-contextmenu": "^2.4.4",
"jquery-simple-upload": "^1.0.0", "jquery-simple-upload": "^1.0.0",
"jquery-smooth-scroll": "^2.0.0",
"jquery-smooth-scroll": "^2.1.2",
"mathjax": "^2.7.0", "mathjax": "^2.7.0",
"node-sass": "latest", "node-sass": "latest",
"nodemon": "latest", "nodemon": "latest",
"pug-lint": "latest", "pug-lint": "latest",
"snyk": "^1.27.1",
"standard": "^10.0.1",
"snyk": "^1.28.1",
"standard": "^10.0.2",
"sticky-js": "^1.1.9", "sticky-js": "^1.1.9",
"twemoji-awesome": "^1.0.4",
"twemoji-awesome": "^1.0.6",
"uglify-js": "latest", "uglify-js": "latest",
"vee-validate": "^2.0.0-beta.25", "vee-validate": "^2.0.0-beta.25",
"vue": "^2.2.6" "vue": "^2.2.6"

4
views/layout.pug

@ -18,8 +18,8 @@ html
link(rel='manifest', href='/manifest.json') link(rel='manifest', href='/manifest.json')
// JS / CSS // JS / CSS
script(type='text/javascript').
window.MathJax = { root:"/js/mathjax" }
//script(type='text/javascript').
script(type='text/javascript', src='/js/bundle.min.js') script(type='text/javascript', src='/js/bundle.min.js')
block head block head

Loading…
Cancel
Save