diff --git a/app.js b/app.js index 708f27d..951fcbb 100644 --- a/app.js +++ b/app.js @@ -5,6 +5,9 @@ var logger = require('morgan'), cookieParser = require('cookie-parser'), bodyParser = require('body-parser'), + compression = require('compression'), + minify = require('express-minify') + uglifyEs = require('uglify-es'), routes = require('./routes/index'), search = require('./routes/search'), @@ -37,7 +40,6 @@ app.use(logger('dev')); app.use(bodyParser.json()); app.use(bodyParser.urlencoded()); app.use(cookieParser()); -app.use(express.static(path.join(__dirname, 'public'))); app.use((req, res, next) => { if (req && req.originalUrl && res) { @@ -45,10 +47,31 @@ app.use((req, res, next) => { } next(); }); +app.use(compression()); +app.use(function(req, res, next) +{ + res.minifyOptions = res.minifyOptions || {}; + res.minifyOptions.js = { output: { comments: 'some' } }; + res.minifyOptions.css = { output: { comments: 'some' } }; + if (/libs\.min\.js$/.test(req.url)) { + res.minifyOptions.minify = false; + } + next(); +}); +app.use(minify({ + cache: 'minify-cache', + uglifyJsModule: uglifyEs, + sassMatch: false, + lessMatch: false, + stylusMatch: false, + coffeeScriptMatch: false + })); app.use('/', routes); app.use('/search/', search); +app.use(express.static(path.join(__dirname, 'public'))); + /// catch 404 and forwarding to error handler app.use(function(req, res, next) { res.status(404).sendFile(path.join(__dirname + '/public/errors', '404.html')); diff --git a/minify-cache/.gitignore b/minify-cache/.gitignore new file mode 100644 index 0000000..94548af --- /dev/null +++ b/minify-cache/.gitignore @@ -0,0 +1,3 @@ +* +*/ +!.gitignore diff --git a/package.json b/package.json index b0c8d99..831b61d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mysticbits/codex-mythica", - "version": "0.1.2", + "version": "0.1.3", "private": true, "scripts": { "start": "nodejs ./bin/www" @@ -11,9 +11,11 @@ "debug": "~0.7.4", "ejs": "^2.5.7", "express": "~4.16.0", + "express-minify": "^1.0.0", "jade": "~1.3.0", "morgan": "~1.0.0", - "static-favicon": "~1.0.0" + "static-favicon": "~1.0.0", + "uglify-es": "^3.3.5" }, "author": { "name": "Eric Woodward", diff --git a/public/scripts/libs.min.js b/public/scripts/libs.min.js index a41d299..a700dab 100644 --- a/public/scripts/libs.min.js +++ b/public/scripts/libs.min.js @@ -1,54 +1,45 @@ - /* @license -docready.js + /* +@module docready.js +@license The MIT License (MIT) +@copyright Copyright (c) 2014 John Friend https://github.com/jfriend00/docReady -The MIT License (MIT) -Copyright (c) 2014 John Friend */ - !function(t,e){"use strict";function n(){if(!a){a=!0;for(var t=0;t=-r&&n.top-window.innerHeight=-r&&n.left-window.innerWidth1){if(r=e({path:"/"},t.defaults,r),"number"==typeof r.expires){var s=new Date;s.setMilliseconds(s.getMilliseconds()+864e5*r.expires),r.expires=s}try{c=JSON.stringify(i),/^[\{\[]/.test(c)&&(i=c)}catch(e){}return i=o.write?o.write(i,n):encodeURIComponent(String(i)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),n=encodeURIComponent(String(n)),n=n.replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent),n=n.replace(/[\(\)]/g,escape),document.cookie=[n,"=",i,r.expires&&"; expires="+r.expires.toUTCString(),r.path&&"; path="+r.path,r.domain&&"; domain="+r.domain,r.secure?"; secure":""].join("")}n||(c={});for(var a=document.cookie?document.cookie.split("; "):[],p=/(%[0-9A-Z]{2})+/g,d=0;d -1) { document @@ -95,7 +102,7 @@ .replace(/\\.html?$/, "") .replace(/\//g, " "); } - + }, 1); }); }()); diff --git a/public/styles/styles.css b/public/styles/styles.css index 68364fe..70c0b76 100644 --- a/public/styles/styles.css +++ b/public/styles/styles.css @@ -1,10 +1,11 @@ -/**************************************************************************** - * The Codex Mythica +/*! + * @project The Codex Mythica * - * Copyright 2017-2018 Eric Woodward - * Source released under CC0 Public Domain License v1.0 + * @copyright Copyright 2017-2018 Eric Woodward + * @license CC0 Public Domain License v1.0 * http://creativecommons.org/publicdomain/zero/1.0/ - ****************************************************************************/ + * + */ @font-face { font-family: 'liberation_serif'; @@ -411,6 +412,10 @@ p { width: 100%; } +.searchForm legend { + color: #FFFDD7; +} + .searchForm ul { list-style-type: none; padding: 0; diff --git a/views/partials/card.ejs b/views/partials/card.ejs index 4514253..610864e 100644 --- a/views/partials/card.ejs +++ b/views/partials/card.ejs @@ -21,7 +21,7 @@
<%= card.num.toUpperCase() %>
Release
-
<%- release_map[card.num.toLowerCase().substr(0,3)] %>
+
<%- release_map[card.num.toLowerCase().substr(0,4)] %>
<% if (card.culture !== '') { %>
Pantheon