Skip to content

Commit

Permalink
*express-minify* now compresses .meta.js and .user.js in express 4
Browse files Browse the repository at this point in the history
* Unfortunately I don't see an option to keep comments. :\
* Disable minification in `sendMeta` and `sendScript`
* Missing in README.md ... added and whoops

Applies to #417
  • Loading branch information
Martii committed Nov 18, 2014
1 parent 97fc8f1 commit 1b595bb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Expand Up @@ -37,6 +37,7 @@ Repository | Reference | Recent Version
[connect-mongo][connect-mongoGHUrl] | [Documentation][connect-mongoDOCUrl] | [![NPM version][connect-mongoNPMVersionImage]][connect-mongoNPMUrl]
[cookie-parser][cookie-parserGHUrl] | [Documentation][cookie-parserDOCUrl] | [![NPM version][cookie-parserNPMVersionImage]][cookie-parserNPMUrl]
[express][expressGHUrl] | [Documentation][expressDOCUrl] | [![NPM version][expressNPMVersionImage]][expressNPMUrl]
[express-minify][express-minifyGHUrl] | [Documentation][express-minifyDOCUrl] | [![NPM version][express-minifyNPMVersionImage]][express-minifyNPMUrl]
[express-session][express-sessionGHUrl] | [Documentation][express-sessionDOCUrl] | [![NPM version][express-sessionNPMVersionImage]][express-sessionNPMUrl]
[fakes3][fakes3GHUrl] | [Documentation][fakes3DOCUrl] | [![GEM version][fakes3GEMVersionImage]][fakes3GEMUrl]
[font-awesome][font-awesomeGHUrl] | [Documentation][font-awesomeDOCUrl] | [![NPM version][font-awesomeNPMVersionImage]][font-awesomeNPMUrl]
Expand Down Expand Up @@ -167,6 +168,11 @@ Repository | Reference | Recent Version | Referenced
[expressNPMUrl]: https://www.npmjs.org/package/express
[expressNPMVersionImage]: https://img.shields.io/npm/v/express.svg?style=flat

[express-minifyGHUrl]: https://github.com/breeswish/express-minify
[express-minifyDOCUrl]: https://github.com/breeswish/express-minify/blob/master/README.md
[express-minifyNPMUrl]: https://www.npmjs.org/package/express-minify
[express-minifyNPMVersionImage]: https://img.shields.io/npm/v/express-minify.svg?style=flat

[express-sessionGHUrl]: https://github.com/expressjs/session
[express-sessionDOCUrl]: https://github.com/expressjs/session/blob/master/README.md
[express-sessionNPMUrl]: https://npmjs.org/package/express-session
Expand Down
2 changes: 2 additions & 0 deletions controllers/scriptStorage.js
Expand Up @@ -73,6 +73,7 @@ exports.sendScript = function (aReq, aRes, aNext) {

// Send the script
aRes.set('Content-Type', 'text/javascript; charset=UTF-8');
aRes._no_minify = true;
aStream.pipe(aRes);

// Don't count installs on raw source route
Expand Down Expand Up @@ -101,6 +102,7 @@ exports.sendMeta = function (aReq, aRes, aNext) {
if (!aScript) { return aNext(); }

aRes.set('Content-Type', 'text/javascript; charset=UTF-8');
aRes._no_minify = true;
meta = aScript.meta; // NOTE: Watchpoint

aRes.write('// ==UserScript==\n');
Expand Down

0 comments on commit 1b595bb

Please sign in to comment.