Comparing version 0.2.0 to 0.2.1
@@ -13,3 +13,3 @@ | ||
App.crushScripts = App.optimise = function (website, options) { | ||
App.crushScripts = function (website, options) { | ||
var opts = {}; | ||
@@ -16,0 +16,0 @@ |
@@ -26,2 +26,4 @@ | ||
this.parserOptions = {}; | ||
this.max = false; | ||
this.strict = false; | ||
}; | ||
@@ -149,2 +151,6 @@ | ||
if (self.max) { | ||
code = self.maxCompression(code); | ||
} | ||
return self.onComplete(false, code); // we dont, we are done | ||
@@ -157,3 +163,3 @@ } | ||
if (script.type === 'inline') { | ||
ast = uglify.parse(script.data, self.parserOptions); // parse the javascript | ||
ast = uglify.parse(script.data, {strict: self.strict}); // parse the javascript | ||
ast.print(self.stream); // write it to our stream | ||
@@ -168,3 +174,3 @@ | ||
if (!error) { | ||
ast = uglify.parse(js, self.parserOptions); // parse the javascript | ||
ast = uglify.parse(js, {strict: self.strict}); // parse the javascript | ||
ast.print(self.stream); // write it to our stream | ||
@@ -185,2 +191,25 @@ | ||
}, | ||
/* | ||
Performs maximun compression | ||
*/ | ||
maxCompression: function (code) { | ||
var ast = uglify.parse(code), compressor; | ||
// compressor - reduces the code size by applying various optimizations | ||
ast.figure_out_scope(); | ||
compressor = uglify.Compressor(); | ||
ast = ast.transform(compressor); | ||
// Name Mangler - reduces names of local variables and functions | ||
ast.figure_out_scope(); | ||
ast.compute_char_frequency(); | ||
ast.mangle_names(); | ||
code = ast.print_to_string(); // get compressed code | ||
return code; | ||
}, | ||
@@ -187,0 +216,0 @@ |
{ | ||
"name": "crushit", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "Script minifier for production", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -6,3 +6,4 @@ | ||
describe('crushIt', function() { | ||
"use strict"; | ||
/* | ||
@@ -45,7 +46,4 @@ init is a method that initializes the app | ||
directory: '/', | ||
comments: false, | ||
parserOptions: { | ||
strict: false | ||
}, | ||
comments: false, | ||
strict: false, | ||
beautify: false | ||
@@ -68,6 +66,3 @@ }); | ||
comments: false, | ||
parserOptions: { | ||
strict: false | ||
}, | ||
strict: false, | ||
beautify: false | ||
@@ -79,3 +74,3 @@ }); | ||
crushIt.beautify.should.be.false; | ||
crushIt.parserOptions.strict.should.be.false; | ||
crushIt.strict.should.be.false; | ||
}); | ||
@@ -82,0 +77,0 @@ }); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22403
582