You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 20, 2020. It is now read-only.
Because JSON is not quite valid Javascript. For example:
{ "success" : "true" }
is valid JSON but not valid JS! In JS that is considered to be a code block, not an object literal. To be valid JS it would need to be:
({ "success" : "true" })
The result is that a request with Accept: application/json fails to minify:
2013/08/26 20:35:45 [log] (express-minify/minify.js:39:10|minifyIt) Minifying some content of type '1' content={
"retStatus": "success"
}
WARN: ERROR: Unexpected token: punc (:) [?:2,13]
node_modules/express-minify/node_modules/uglify-js/lib/parse.js:199
throw new JS_Parse_Error(message, line, col, pos);
^
Error
at new JS_Parse_Error (node_modules/express-minify/node_modules/uglify-js/lib/parse.js:185:18)
at js_error (node_modules/express-minify/node_modules/uglify-js/lib/parse.js:199:11)
at croak (node_modules/express-minify/node_modules/uglify-js/lib/parse.js:630:9)
at token_error (node_modules/express-minify/node_modules/uglify-js/lib/parse.js:638:9)
at unexpected (node_modules/express-minify/node_modules/uglify-js/lib/parse.js:644:9)
...
My suggestion is that JSON should not be marked for minifying. Alternatively, if you want to minify JSON, wrap it in (...) before passng to Uglify, and remove the parentheses afterwards.
The text was updated successfully, but these errors were encountered:
Hello, I dropped json from js_match regexp. What's more, you can use res._no_minify = true to disable minifying specific file now. These changes has been published to version 0.0.5.
Because JSON is not quite valid Javascript. For example:
is valid JSON but not valid JS! In JS that is considered to be a code block, not an object literal. To be valid JS it would need to be:
The result is that a request with
Accept: application/json
fails to minify:My suggestion is that JSON should not be marked for minifying. Alternatively, if you want to minify JSON, wrap it in
(...)
before passng to Uglify, and remove the parentheses afterwards.The text was updated successfully, but these errors were encountered: