Comparing version 1.2.18 to 1.3.0
@@ -412,5 +412,5 @@ function TRBL(name, imp) { | ||
this.init(); | ||
this.info = typeof tree[0] !== 'string'; | ||
this.info = true; | ||
var x = this.info ? tree : this.injectInfo([tree])[0], | ||
var x = (typeof tree[0] !== 'string') ? tree : this.injectInfo([tree])[0], | ||
l0, l1 = 100000000000, ls, | ||
@@ -424,2 +424,3 @@ x0, x1, xs; | ||
x = this.walk(this.frrules, x, '/0'); | ||
ls = translator.translate(cleanInfo(x)).length; | ||
@@ -426,0 +427,0 @@ |
@@ -32,6 +32,6 @@ var fs = require('fs'), | ||
if (single.contains(['-dp', '--parser'])) csso.printTree(csso.cleanInfo(csso.parse(src, rule))); | ||
if (single.contains(['-dp', '--parser'])) csso.printTree(csso.cleanInfo(csso.parse(src, rule, true))); | ||
else { | ||
if (!outFile) print(csso.justDoIt(src, ro)); | ||
else fs.writeFileSync(outFile, csso.justDoIt(src, ro)); | ||
if (!outFile) print(csso.justDoIt(src, ro, true)); | ||
else fs.writeFileSync(outFile, csso.justDoIt(src, ro, true)); | ||
} | ||
@@ -38,0 +38,0 @@ } |
var util = require('./util.js'), | ||
parser = require('./parser.js'), | ||
gonzales = require('./gonzales.cssp.node.js'), | ||
translator = require('./translator.js'), | ||
compressor = require('./compressor.js'); | ||
var parse = exports.parse = parser.parse; | ||
var parse = exports.parse = function(s, rule, needInfo) { | ||
return gonzales.srcToCSSP(s, rule, needInfo); | ||
}; | ||
@@ -18,4 +20,4 @@ var cleanInfo = exports.cleanInfo = util.cleanInfo; | ||
exports.justDoIt = function(src, ro) { | ||
return translate(cleanInfo(compress(parse(src, 'stylesheet'), ro))); | ||
exports.justDoIt = function(src, ro, needInfo) { | ||
return translate(cleanInfo(compress(parse(src, 'stylesheet', needInfo), ro))); | ||
}; |
function CSSOTranslator() {} | ||
CSSOTranslator.prototype.translate = function(tree) { | ||
// console.trace('--------'); | ||
// console.log(tree); | ||
return this._t(tree); | ||
@@ -5,0 +7,0 @@ }; |
{ | ||
"name": "csso", | ||
"description": "CSSO — CSS optimizer", | ||
"version": "1.2.18", | ||
"version": "1.3.0", | ||
"homepage": "http://github.com/css/csso", | ||
@@ -6,0 +6,0 @@ "author": "Sergey Kryzhanovsky <skryzhanovsky@ya.ru> (http://github.com/afelix)", |
@@ -246,5 +246,5 @@ | ||
this.init(); | ||
this.info = typeof tree[0] !== 'string'; | ||
this.info = true; | ||
var x = this.info ? tree : this.injectInfo([tree])[0], | ||
var x = (typeof tree[0] !== 'string') ? tree : this.injectInfo([tree])[0], | ||
l0, l1 = 100000000000, ls, | ||
@@ -258,2 +258,3 @@ x0, x1, xs; | ||
x = this.walk(this.frrules, x, '/0'); | ||
ls = translator.translate(cleanInfo(x)).length; | ||
@@ -260,0 +261,0 @@ |
function CSSOTranslator() {} | ||
CSSOTranslator.prototype.translate = function(tree) { | ||
// console.trace('--------'); | ||
// console.log(tree); | ||
return this._t(tree); | ||
@@ -5,0 +7,0 @@ }; |
var fs = require('fs'), | ||
csso = require('./../lib/cssoapi.js'), | ||
treeToString = csso.treeToString, | ||
cleanInfo = csso.cleanInfo, | ||
_parse = csso.parse, | ||
_translate = csso.translate, | ||
_compress = csso.compress, | ||
_cleanInfo = require('./../lib/util.js').cleanInfo, | ||
d_dir = __dirname + '/data', | ||
@@ -14,9 +14,9 @@ d_list = fs.readdirSync(d_dir), | ||
'p': function parse(src, match) { | ||
return treeToString(cleanInfo(_parse(src, match))); | ||
return treeToString(_cleanInfo(_parse(src, match, true))); | ||
}, | ||
'l': function translate(src, match) { | ||
return _translate(cleanInfo(_parse(src, match))); | ||
return _translate(_cleanInfo(_parse(src, match, true))); | ||
}, | ||
'cl': function translate(src, match) { | ||
return _translate(cleanInfo(_compress(_parse(src, match)))); | ||
return _translate(_cleanInfo(_compress(_parse(src, match, true)))); | ||
} | ||
@@ -56,2 +56,6 @@ }; | ||
console.log('FAIL: ' + t + a); | ||
console.log('======= expected'); | ||
console.log(c); | ||
console.log('======= result'); | ||
console.log(b); | ||
} | ||
@@ -58,0 +62,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
527064
10829
1299