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:
parent
bef6e33c79
commit
2c6e502de2
25
app.js
25
app.js
@ -5,6 +5,9 @@ var
|
|||||||
logger = require('morgan'),
|
logger = require('morgan'),
|
||||||
cookieParser = require('cookie-parser'),
|
cookieParser = require('cookie-parser'),
|
||||||
bodyParser = require('body-parser'),
|
bodyParser = require('body-parser'),
|
||||||
|
compression = require('compression'),
|
||||||
|
minify = require('express-minify')
|
||||||
|
uglifyEs = require('uglify-es'),
|
||||||
|
|
||||||
routes = require('./routes/index'),
|
routes = require('./routes/index'),
|
||||||
search = require('./routes/search'),
|
search = require('./routes/search'),
|
||||||
@ -37,7 +40,6 @@ app.use(logger('dev'));
|
|||||||
app.use(bodyParser.json());
|
app.use(bodyParser.json());
|
||||||
app.use(bodyParser.urlencoded());
|
app.use(bodyParser.urlencoded());
|
||||||
app.use(cookieParser());
|
app.use(cookieParser());
|
||||||
app.use(express.static(path.join(__dirname, 'public')));
|
|
||||||
|
|
||||||
app.use((req, res, next) => {
|
app.use((req, res, next) => {
|
||||||
if (req && req.originalUrl && res) {
|
if (req && req.originalUrl && res) {
|
||||||
@ -45,10 +47,31 @@ app.use((req, res, next) => {
|
|||||||
}
|
}
|
||||||
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('/', routes);
|
||||||
app.use('/search/', search);
|
app.use('/search/', search);
|
||||||
|
|
||||||
|
app.use(express.static(path.join(__dirname, 'public')));
|
||||||
|
|
||||||
/// catch 404 and forwarding to error handler
|
/// catch 404 and forwarding to error handler
|
||||||
app.use(function(req, res, next) {
|
app.use(function(req, res, next) {
|
||||||
res.status(404).sendFile(path.join(__dirname + '/public/errors', '404.html'));
|
res.status(404).sendFile(path.join(__dirname + '/public/errors', '404.html'));
|
||||||
|
3
minify-cache/.gitignore
vendored
Normal file
3
minify-cache/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
*
|
||||||
|
*/
|
||||||
|
!.gitignore
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@mysticbits/codex-mythica",
|
"name": "@mysticbits/codex-mythica",
|
||||||
"version": "0.1.2",
|
"version": "0.1.3",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "nodejs ./bin/www"
|
"start": "nodejs ./bin/www"
|
||||||
@ -11,9 +11,11 @@
|
|||||||
"debug": "~0.7.4",
|
"debug": "~0.7.4",
|
||||||
"ejs": "^2.5.7",
|
"ejs": "^2.5.7",
|
||||||
"express": "~4.16.0",
|
"express": "~4.16.0",
|
||||||
|
"express-minify": "^1.0.0",
|
||||||
"jade": "~1.3.0",
|
"jade": "~1.3.0",
|
||||||
"morgan": "~1.0.0",
|
"morgan": "~1.0.0",
|
||||||
"static-favicon": "~1.0.0"
|
"static-favicon": "~1.0.0",
|
||||||
|
"uglify-es": "^3.3.5"
|
||||||
},
|
},
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Eric Woodward",
|
"name": "Eric Woodward",
|
||||||
|
61
public/scripts/libs.min.js
vendored
61
public/scripts/libs.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,18 +1,25 @@
|
|||||||
|
/*
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* The Codex Mythica
|
* The Codex Mythica
|
||||||
*
|
*
|
||||||
* Copyright 2017 Eric Woodward
|
* @copyright Copyright 2017 Eric Woodward
|
||||||
* Source released under CC0 Public Domain License v1.0
|
* @license CC0 Public Domain License v1.0
|
||||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
;
|
;
|
||||||
(function(){
|
(function(){
|
||||||
'use strict';
|
'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;
|
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;
|
protocol = window.location.protocol;
|
||||||
|
|
||||||
// Indicate JS is loaded
|
// Indicate JS is loaded
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
/****************************************************************************
|
/*!
|
||||||
* The Codex Mythica
|
* @project The Codex Mythica
|
||||||
*
|
*
|
||||||
* Copyright 2017-2018 Eric Woodward
|
* @copyright Copyright 2017-2018 Eric Woodward
|
||||||
* Source released under CC0 Public Domain License v1.0
|
* @license CC0 Public Domain License v1.0
|
||||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||||
****************************************************************************/
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'liberation_serif';
|
font-family: 'liberation_serif';
|
||||||
@ -411,6 +412,10 @@ p {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.searchForm legend {
|
||||||
|
color: #FFFDD7;
|
||||||
|
}
|
||||||
|
|
||||||
.searchForm ul {
|
.searchForm ul {
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
<dd><%= card.num.toUpperCase() %></dd>
|
<dd><%= card.num.toUpperCase() %></dd>
|
||||||
|
|
||||||
<dt>Release</dt>
|
<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 !== '') { %>
|
<% if (card.culture !== '') { %>
|
||||||
<dt>Pantheon</dt>
|
<dt>Pantheon</dt>
|
||||||
|
Loading…
Reference in New Issue
Block a user