Permalink
Browse files

Revert "Merge pull request #468 from cweider/minify-simplify"

This reverts commit 611cfbd, reversing
changes made to bf42359.

Conflicts:

	node/server.js
	node/utils/Minify.js
	node/utils/Settings.js
	node/utils/caching_middleware.js
	package.json
	settings.json.template
	static/pad.html
	static/timeslider.html
  • Loading branch information...
1 parent 6db20a3 commit 7c2950446fd063e3df513e85bad3cf2575198e9e @rossmeissl rossmeissl committed Apr 10, 2012
Showing with 277 additions and 400 deletions.
  1. +16 −22 node/server.js
  2. +252 −187 node/utils/Minify.js
  3. +1 −6 node/utils/Settings.js
  4. +0 −177 node/utils/caching_middleware.js
  5. +0 −2 package.json
  6. +5 −3 static/js/ace.js
  7. +2 −2 static/pad.html
  8. +1 −1 static/timeslider.html
View
@@ -30,8 +30,6 @@ var async = require('async');
var express = require('express');
var path = require('path');
var minify = require('./utils/Minify');
-var CachingMiddleware = require('./utils/caching_middleware');
-var Yajsml = require('yajsml');
var formidable = require('formidable');
var apiHandler;
var exportHandler;
@@ -62,7 +60,8 @@ console.log("Report bugs at https://github.com/Pita/etherpad-lite/issues")
var serverName = "Etherpad-Lite " + version + " (http://j.mp/ep-lite)";
-exports.maxAge = settings.maxAge;
+//cache 6 hours
+exports.maxAge = 1000*60*60*6;
//set loglevel
log4js.setGlobalLogLevel(settings.loglevel);
@@ -141,26 +140,21 @@ async.waterfall([
gracefulShutdown();
});
- // Cache both minified and static.
- var assetCache = new CachingMiddleware;
- app.all('/(minified|static)/*', assetCache.handle);
-
- // Minify will serve static files compressed (minify enabled). It also has
- // file-specific hacks for ace/require-kernel/etc.
- app.all('/static/:filename(*)', minify.minify);
-
- // Setup middleware that will package JavaScript files served by minify for
- // CommonJS loader on the client-side.
- var jsServer = new (Yajsml.Server)({
- rootPath: 'minified/'
- , rootURI: 'http://localhost:' + settings.port + '/static/js/'
+ //serve static files
+ app.get('/static/js/require-kernel.js', function (req, res, next) {
+ res.header("Content-Type","application/javascript; charset: utf-8");
+ res.write(minify.requireDefinition());
+ res.end();
+ });
+ app.get('/static/*', function(req, res)
+ {
+ var filePath = path.normalize(__dirname + "/.." +
+ req.url.replace(/\.\./g, '').split("?")[0]);
+ res.sendfile(filePath, { maxAge: exports.maxAge });
});
- var StaticAssociator = Yajsml.associators.StaticAssociator;
- var associations =
- Yajsml.associators.associationsForSimpleMapping(minify.tar);
- var associator = new StaticAssociator(associations);
- jsServer.setAssociator(associator);
- app.use(jsServer);
+
+ //serve minified files
+ app.get('/minified/:filename', minify.minifyJS);
//checks for padAccess
function hasPadAccess(req, res, callback)
Oops, something went wrong.

0 comments on commit 7c29504

Please sign in to comment.