Comparing version 0.3.5 to 0.3.6
{ | ||
"name": "more-css", | ||
"version": "0.3.5", | ||
"version": "0.3.6", | ||
"description": "a css pre-compiler & agressive compressor", | ||
@@ -5,0 +5,0 @@ "maintainers": [ |
@@ -39,2 +39,6 @@ ##A css pre-compiler by javascript | ||
more.global(global:Object<String, String/Number/Boolean>):Object<String, String/Number/Boolean> | ||
设置全局变量,可在所有文件中被访问。局部变量拥有更高优先级。 | ||
more.styles():Object<String, String> | ||
@@ -41,0 +45,0 @@ |
@@ -22,3 +22,4 @@ var CssLexer = require('./lexer/CssLexer'), | ||
levels, | ||
exArr; | ||
exArr, | ||
global; | ||
@@ -45,2 +46,3 @@ function init(ignore) { | ||
exArr = []; | ||
global = {}; | ||
} | ||
@@ -82,4 +84,5 @@ function preVar(node) { | ||
c = s.slice(i + 2, j); | ||
if(varHash[c]) { | ||
s = s.slice(0, i) + (type == Token.STRING && /^['"]/.test(s) ? varHash[c].replace(/^(['"])(.*)\1$/, '$2') : varHash[c]) + s.slice(j + 1); | ||
var vara = varHash[c] || global[c]; | ||
if(vara) { | ||
s = s.slice(0, i) + (type == Token.STRING && /^['"]/.test(s) ? vara.replace(/^(['"])(.*)\1$/, '$2') : vara) + s.slice(j + 1); | ||
} | ||
@@ -90,4 +93,5 @@ } | ||
c = /^[\w-]+/.exec(s.slice(i + 1))[0]; | ||
if(varHash[c]) { | ||
s = s.slice(0, i) + (type == Token.STRING && /^['"]/.test(s) ? varHash[c].replace(/^(['"])(.*)\1$/, '$2') : varHash[c]) + s.slice(i + c.length + 1); | ||
var vara = varHash[c] || global[c]; | ||
if(vara) { | ||
s = s.slice(0, i) + (type == Token.STRING && /^['"]/.test(s) ? vara.replace(/^(['"])(.*)\1$/, '$2') : vara) + s.slice(i + c.length + 1); | ||
} | ||
@@ -361,2 +365,6 @@ } | ||
}; | ||
exports.global = function(g) { | ||
global = g; | ||
return global; | ||
}; | ||
exports.imports = function() { | ||
@@ -363,0 +371,0 @@ return imports; |
@@ -23,3 +23,4 @@ define(function(require, exports) { | ||
levels, | ||
exArr; | ||
exArr, | ||
global; | ||
@@ -46,2 +47,3 @@ function init(ignore) { | ||
exArr = []; | ||
global = {}; | ||
} | ||
@@ -83,4 +85,5 @@ function preVar(node) { | ||
c = s.slice(i + 2, j); | ||
if(varHash[c]) { | ||
s = s.slice(0, i) + (type == Token.STRING && /^['"]/.test(s) ? varHash[c].replace(/^(['"])(.*)\1$/, '$2') : varHash[c]) + s.slice(j + 1); | ||
var vara = varHash[c] || global[c]; | ||
if(vara) { | ||
s = s.slice(0, i) + (type == Token.STRING && /^['"]/.test(s) ? vara.replace(/^(['"])(.*)\1$/, '$2') : vara) + s.slice(j + 1); | ||
} | ||
@@ -91,4 +94,5 @@ } | ||
c = /^[\w-]+/.exec(s.slice(i + 1))[0]; | ||
if(varHash[c]) { | ||
s = s.slice(0, i) + (type == Token.STRING && /^['"]/.test(s) ? varHash[c].replace(/^(['"])(.*)\1$/, '$2') : varHash[c]) + s.slice(i + c.length + 1); | ||
var vara = varHash[c] || global[c]; | ||
if(vara) { | ||
s = s.slice(0, i) + (type == Token.STRING && /^['"]/.test(s) ? vara.replace(/^(['"])(.*)\1$/, '$2') : vara) + s.slice(i + c.length + 1); | ||
} | ||
@@ -362,2 +366,6 @@ } | ||
}; | ||
exports.global = function(g) { | ||
global = g; | ||
return global; | ||
}; | ||
exports.imports = function() { | ||
@@ -364,0 +372,0 @@ return imports; |
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
415991
9617
71