UPDATED copyrights in JS & CSS files.

ADDED minify & compression support.
FIXED bug w/ missing release data.
UPDATED to v0.1.3
This commit is contained in:
Eric Woodward 2018-01-10 21:57:18 -05:00
parent bef6e33c79
commit 2c6e502de2
7 changed files with 84 additions and 55 deletions

25
app.js
View File

@ -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'));

3
minify-cache/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
*
*/
!.gitignore

View File

@ -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",

File diff suppressed because one or more lines are too long

View File

@ -1,18 +1,25 @@
/*
/****************************************************************************
* The Codex Mythica
*
* Copyright 2017 Eric Woodward
* Source released under CC0 Public Domain License v1.0
* @copyright Copyright 2017 Eric Woodward
* @license CC0 Public Domain License v1.0
* http://creativecommons.org/publicdomain/zero/1.0/
****************************************************************************/
;
(function(){
'use strict';
// Checking if browser "cuts the mustard" - https://gomakethings.com/ditching-jquery/
// Check if the browser "cuts the mustard" - https://gomakethings.com/ditching-jquery/
if ( !(!!document.querySelector && !!window.addEventListener) ) return;
var
// NodeLisr.forEach polyfill for IE11
// See: https://github.com/imagitama/nodelist-foreach-polyfill/issues/3
if (window.NodeList && !NodeList.prototype.forEach) {
NodeList.prototype.forEach = Array.prototype.forEach;
}
let
protocol = window.location.protocol;
// Indicate JS is loaded
@ -46,7 +53,7 @@
if (typeof loadMedia === 'function') {
loadMedia('.js-lazyLoader', null, true);
}
document
.querySelectorAll('.js-checkToggle')
.forEach(function (el) {
@ -62,7 +69,7 @@
});
});
});
/*
document
.querySelectorAll('.js-ulToggle')
@ -82,8 +89,8 @@
});
});
*/
// fix search link on 404
if (document.documentElement.className.indexOf('is404') > -1) {
document
@ -95,7 +102,7 @@
.replace(/\\.html?$/, "")
.replace(/\//g, " ");
}
}, 1);
});
}());

View File

@ -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;

View File

@ -21,7 +21,7 @@
<dd><%= card.num.toUpperCase() %></dd>
<dt>Release</dt>
<dd><%- release_map[card.num.toLowerCase().substr(0,3)] %></dd>
<dd><%- release_map[card.num.toLowerCase().substr(0,4)] %></dd>
<% if (card.culture !== '') { %>
<dt>Pantheon</dt>