Add configuration option to use express-minify for CSS and JS

This commit is contained in:
Calvin Montgomery 2014-02-04 11:32:52 -06:00
parent e6acf92bdb
commit 6fe31b9a3e
5 changed files with 50 additions and 2 deletions

View File

@ -15,6 +15,8 @@ http:
host: ''
port: 8080
domain: 'http://localhost'
# Use express-minify to minify CSS and Javascript
minify: false
# HTTPS server details
https:

View File

@ -25,7 +25,8 @@ var defaults = {
http: {
host: "",
port: 8080,
domain: "http://localhost"
domain: "http://localhost",
minify: false
},
https: {
enabled: false,

View File

@ -184,6 +184,11 @@ module.exports = {
app.use(express.json());
app.use(express.urlencoded());
app.use(express.cookieParser());
if (Config.get("http.minify")) {
app.use(require("express-minify")());
Logger.syslog.log("Enabled express-minify for CSS and JS");
}
/* Order here is important
* Since I placed /r/:channel above *, the function will
* not apply to the /r/:channel route. This prevents

View File

@ -14,6 +14,7 @@
"socket.io": "~0.9.16",
"nodemailer": "~0.6.0",
"cookie": "~0.1.0",
"yamljs": "~0.1.4"
"yamljs": "~0.1.4",
"express-minify": "0.0.7"
}
}

39
test-database.js Normal file
View File

@ -0,0 +1,39 @@
var cfg = {
"mysql-server": "localhost",
"mysql-user": "syncdevel",
"mysql-db": "syncdevel",
"mysql-pw": "tacky",
"debug": true
};
var Database = require("./database");
var db = new Database(cfg);
var assert = require('assert');
db.init();
setTimeout(function () {
db.channelExists("adsjnfgjdsg", function (err, res) {
assert(!err && !res);
});
db.channelExists("xchan", function (err, res) {
assert(!err && res);
});
db.removeFromLibrary("xchan", "xxx2364", function (err, res) {
assert(!err);
console.log(res);
});
db.getLibraryItem("xchan", "xxx23456", function (err, media) {
assert(!err);
assert(media === null);
});
db.getLibraryItem("xchan", "G7X5s5vacIU", function (err, media) {
assert(!err);
assert(media !== null);
assert(media.id === "G7X5s5vacIU");
});
}, 1000);