Add caching to minify

This commit is contained in:
calzoneman 2014-02-24 18:32:54 -06:00
parent 5d9a8a1a3f
commit 5565dd49fd
2 changed files with 9 additions and 1 deletions

1
.gitignore vendored
View file

@ -9,3 +9,4 @@ node_modules
*.cert *.cert
*.key *.key
torlist torlist
www/cache

View file

@ -1,4 +1,5 @@
var path = require("path"); var path = require("path");
var fs = require("fs");
var net = require("net"); var net = require("net");
var express = require("express"); var express = require("express");
var webroot = path.join(__dirname, "..", "www"); var webroot = path.join(__dirname, "..", "www");
@ -274,7 +275,13 @@ module.exports = {
app.use(express.cookieParser()); app.use(express.cookieParser());
if (Config.get("http.minify")) { if (Config.get("http.minify")) {
app.use(require("express-minify")()); var cache = path.join(__dirname, "..", "..", "www", "cache")
if (!fs.existsSync(cache)) {
fs.mkdirSync(cache);
}
app.use(require("express-minify")({
cache: cache
}));
Logger.syslog.log("Enabled express-minify for CSS and JS"); Logger.syslog.log("Enabled express-minify for CSS and JS");
} }
/* Order here is important /* Order here is important