diff --git a/.gitignore b/.gitignore index 5d08c4fe..94363a37 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,7 @@ newrelic.js # Fusebox .fusebox +.build # Config Files config.yml diff --git a/client/js/pages/view.js b/client/js/pages/view.js index 88aeb43f..72c07f42 100644 --- a/client/js/pages/view.js +++ b/client/js/pages/view.js @@ -19,8 +19,14 @@ module.exports = (alerts) => { scale: 120, font: 'STIX-Web' }, - showMathMenu: false + tex2jax: { + preview: 'none' + }, + showMathMenu: false, + showProcessingMessages: false, + messageStyle: 'none' }) + MathJax.Hub.Configured() require('../modals/create.js')(currentBasePath) require('../modals/move.js')(currentBasePath, alerts) diff --git a/client/js/pre-init/mathjax.js b/client/js/pre-init/mathjax.js new file mode 100644 index 00000000..d784bc23 --- /dev/null +++ b/client/js/pre-init/mathjax.js @@ -0,0 +1,4 @@ +window.MathJax = { + root: '/js/mathjax', + delayStartupUntil: 'configured' +} diff --git a/fuse.js b/fuse.js index edb69922..70c3e87b 100644 --- a/fuse.js +++ b/fuse.js @@ -56,6 +56,10 @@ const ALIASES = { 'vue': 'vue/dist/vue.min.js' } const SHIMS = { + _preinit: { + source: '.build/_preinit.js', + exports: '_preinit' + }, jquery: { source: 'node_modules/jquery/dist/jquery.js', exports: '$' @@ -72,6 +76,7 @@ const SHIMS = { console.info(colors.white('└── ') + colors.green('Running global tasks...')) +let preInitContent = '' let globalTasks = Promise.mapSeries([ /** * ACE Modes @@ -144,6 +149,20 @@ let globalTasks = Promise.mapSeries([ 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() }) @@ -251,6 +270,7 @@ globalTasks.then(() => { shim: SHIMS, plugins: [ fsbx.EnvPlugin({ NODE_ENV: 'production' }), + fsbx.BannerPlugin(preInitContent), [ fsbx.SassPlugin({ outputStyle: 'compressed', includePaths: ['./node_modules/requarks-core'] }), fsbx.CSSPlugin() ], fsbx.BabelPlugin({ config: { diff --git a/package.json b/package.json index 12b603ea..eda3656f 100644 --- a/package.json +++ b/package.json @@ -41,12 +41,12 @@ "auto-load": "^2.1.0", "axios": "^0.16.1", "bcryptjs-then": "^1.0.1", - "bluebird": "^3.4.7", + "bluebird": "^3.5.0", "body-parser": "^1.17.1", - "bunyan": "^1.8.9", + "bunyan": "^1.8.10", "cheerio": "^0.22.0", "child-process-promise": "^2.2.1", - "chokidar": "^1.6.0", + "chokidar": "^1.6.1", "commander": "^2.9.0", "compression": "^1.6.2", "connect-flash": "^0.1.1", @@ -55,17 +55,17 @@ "cron": "^1.2.1", "execa": "^0.6.3", "express": "^4.15.2", - "express-brute": "^1.0.0", + "express-brute": "^1.0.1", "express-brute-mongoose": "0.0.8", "express-session": "^1.15.2", - "file-type": "^4.0.0", + "file-type": "^4.1.0", "filesize.js": "^1.0.2", "follow-redirects": "^1.2.3", "fs-extra": "^2.1.2", "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", "image-size": "^0.5.1", "jimp": "github:ngpixel/jimp", @@ -73,8 +73,8 @@ "jsonwebtoken": "^7.3.0", "klaw": "^1.3.1", "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-anchor": "^4.0.0", "markdown-it-attrs": "^0.8.0", @@ -89,8 +89,8 @@ "moment": "^2.18.1", "moment-timezone": "^0.5.13", "mongodb": "^2.2.25", - "mongoose": "^4.9.2", - "multer": "^1.2.1", + "mongoose": "^4.9.4", + "multer": "^1.3.0", "ora": "^1.2.0", "passport": "^0.3.2", "passport-azure-ad-oauth2": "0.0.4", @@ -129,7 +129,7 @@ "brace": "^0.10.0", "colors": "^1.1.2", "eslint": "latest", - "eslint-config-standard": "^10.2.0", + "eslint-config-standard": "^10.2.1", "eslint-plugin-import": "latest", "eslint-plugin-node": "latest", "eslint-plugin-promise": "latest", @@ -139,15 +139,15 @@ "jquery": "^3.2.1", "jquery-contextmenu": "^2.4.4", "jquery-simple-upload": "^1.0.0", - "jquery-smooth-scroll": "^2.0.0", + "jquery-smooth-scroll": "^2.1.2", "mathjax": "^2.7.0", "node-sass": "latest", "nodemon": "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", - "twemoji-awesome": "^1.0.4", + "twemoji-awesome": "^1.0.6", "uglify-js": "latest", "vee-validate": "^2.0.0-beta.25", "vue": "^2.2.6" diff --git a/views/layout.pug b/views/layout.pug index 9f711278..5f52c3aa 100644 --- a/views/layout.pug +++ b/views/layout.pug @@ -18,8 +18,8 @@ html link(rel='manifest', href='/manifest.json') // JS / CSS - script(type='text/javascript'). - window.MathJax = { root:"/js/mathjax" } + //script(type='text/javascript'). + script(type='text/javascript', src='/js/bundle.min.js') block head