gonzales-pe
Advanced tools
Comparing version 2.0.1 to 2.0.2
Gonzales changelog | ||
================== | ||
29.12.2013, Version 2.0.2 | ||
------------------------- | ||
- Sass includes can have both arguments list and content block, | ||
i.e. `@include nani() { color: tomato }` is valid syntax. | ||
18.11.2013, Version 2.0.1 | ||
@@ -5,0 +11,0 @@ ------------------------- |
{ | ||
"name": "gonzales-pe", | ||
"description": "Gonzales Preprocessor Edition (fast CSS parser)", | ||
"version": "2.0.1", | ||
"homepage": "http://github.com/tonyganch/gonzales-pe", | ||
"bugs": "http://github.com/tonyganch/gonzales-pe/issues", | ||
"license": "MIT", | ||
"author": "Tony Ganch <tonyganch@gmail.com>", | ||
"main": "./lib/gonzales", | ||
"repository": { | ||
"type": "git", | ||
"url": "http://github.com/tonyganch/gonzales-pe.git" | ||
}, | ||
"scripts": { | ||
"test": "(make && mkdir -p log && node ./test/test.js) | tee ./log/test.log" | ||
}, | ||
"devDependencies": { | ||
"benchmark": "~1.0.0", | ||
"microtime": "~0.3.3" | ||
}, | ||
"engines": { | ||
"node": ">=0.6.0" | ||
} | ||
"name": "gonzales-pe", | ||
"description": "Gonzales Preprocessor Edition (fast CSS parser)", | ||
"version": "2.0.2", | ||
"homepage": "http://github.com/tonyganch/gonzales-pe", | ||
"bugs": "http://github.com/tonyganch/gonzales-pe/issues", | ||
"license": "MIT", | ||
"author": { | ||
"name" : "Tony Ganch", | ||
"email" : "tonyganch+github@gmail.com", | ||
"url" : "http://tonyganch.com" | ||
}, | ||
"main": "./lib/gonzales", | ||
"repository": { | ||
"type": "git", | ||
"url": "http://github.com/tonyganch/gonzales-pe.git" | ||
}, | ||
"scripts": { | ||
"test": "(make && mkdir -p log && node ./test/test.js) | tee ./log/test.log" | ||
}, | ||
"devDependencies": { | ||
"benchmark": "~1.0.0", | ||
"microtime": "~0.3.3" | ||
}, | ||
"engines": { | ||
"node": ">=0.6.0" | ||
} | ||
} |
@@ -1,23 +0,14 @@ | ||
function astToCSS(options) { | ||
var tree, hasInfo, syntax; | ||
if (!options) throw new Error('We need tree to translate'); | ||
if (typeof options === 'string') tree = options; | ||
else { | ||
tree = options.ast; | ||
hasInfo = typeof tree[0] === 'object'; | ||
syntax = options.syntax; | ||
} | ||
function csspToSrc(tree, hasInfo) { | ||
var _m_simple = { | ||
'attrselector': 1, 'combinator': 1, 'ident': 1, 'nth': 1, 'number': 1, | ||
'operator': 1, 'raw': 1, 's': 1, 'string': 1, 'unary': 1, 'unknown': 1 | ||
'unary': 1, 'nth': 1, 'combinator': 1, 'ident': 1, 'number': 1, 's': 1, | ||
'string': 1, 'attrselector': 1, 'operator': 1, 'raw': 1, 'unknown': 1 | ||
}, | ||
_m_composite = { | ||
'atruleb': 1, 'atrulerq': 1, 'atrulers': 1, 'atrules': 1,'condition': 1, | ||
'dimension': 1, 'filterv': 1, 'include': 1, 'loop': 1, 'mixin': 1, | ||
'selector': 1, 'progid': 1, 'property': 1, 'ruleset': 1, | ||
'simpleselector': 1, 'stylesheet': 1, 'value': 1 | ||
'simpleselector': 1, 'dimension': 1, 'selector': 1, 'property': 1, 'value': 1, | ||
'filterv': 1, 'progid': 1, 'ruleset': 1, 'atruleb': 1, 'atrulerq': 1, 'atrulers': 1, | ||
'stylesheet': 1 | ||
}, | ||
_m_primitive = { | ||
'cdc': 'cdc', 'cdo': 'cdo', 'decldelim': ';', 'delim': ',', | ||
'namespace': '|', 'parentselector': '&' | ||
'cdo': 'cdo', 'cdc': 'cdc', 'decldelim': ';', 'namespace': '|', 'delim': ',', | ||
'parentselector': '&' | ||
}; | ||
@@ -41,73 +32,64 @@ function _t(tree) { | ||
var _unique = { | ||
'arguments': function(t) { | ||
return '(' + _composite(t) + ')'; | ||
'percentage': function(t) { | ||
return _t(t[hasInfo? 2 : 1]) + '%'; | ||
}, | ||
'comment': function (t) { | ||
return '/*' + t[hasInfo? 2 : 1] + '*/'; | ||
}, | ||
'clazz': function(t) { | ||
return '.' + _t(t[hasInfo? 2 : 1]); | ||
}, | ||
'atkeyword': function(t) { | ||
return '@' + _t(t[hasInfo? 2 : 1]); | ||
}, | ||
'atruler': function(t) { | ||
return _t(t[hasInfo? 2 : 1]) + _t(t[hasInfo? 3 : 2]) + '{' + _t(t[hasInfo? 4 : 3]) + '}'; | ||
'shash': function (t) { | ||
return '#' + t[hasInfo? 2 : 1]; | ||
}, | ||
'vhash': function(t) { | ||
return '#' + t[hasInfo? 2 : 1]; | ||
}, | ||
'attrib': function(t) { | ||
return '[' + _composite(t) + ']'; | ||
}, | ||
'block': function(t) { | ||
return '{' + _composite(t) + '}'; | ||
'important': function(t) { | ||
return '!' + _composite(t) + 'important'; | ||
}, | ||
'braces': function(t) { | ||
return t[hasInfo? 2 : 1] + _composite(t, hasInfo? 4 : 3) + t[hasInfo? 3 : 2]; | ||
'nthselector': function(t) { | ||
return ':' + _simple(t[hasInfo? 2 : 1]) + '(' + _composite(t, hasInfo? 3 : 2) + ')'; | ||
}, | ||
'clazz': function(t) { | ||
return '.' + _t(t[hasInfo? 2 : 1]); | ||
'funktion': function(t) { | ||
return _simple(t[hasInfo? 2 : 1]) + '(' + _composite(t[hasInfo? 3: 2]) + ')'; | ||
}, | ||
'commentML': function (t) { | ||
return '/*' + t[hasInfo? 2 : 1] + '*/'; | ||
}, | ||
'commentSL': function (t) { | ||
return '/' + '/' + t[hasInfo? 2 : 1]; | ||
}, | ||
'declaration': function(t) { | ||
return _t(t[hasInfo? 2 : 1]) + ':' + _t(t[hasInfo? 3 : 2]); | ||
}, | ||
'default': function(t) { | ||
return '!' + _composite(t) + 'default'; | ||
}, | ||
'filter': function(t) { | ||
return _t(t[hasInfo? 2 : 1]) + ':' + _t(t[hasInfo? 3 : 2]); | ||
}, | ||
'functionExpression': function(t) { | ||
return 'expression(' + t[hasInfo? 2 : 1] + ')'; | ||
'block': function(t) { | ||
return '{' + _composite(t) + '}'; | ||
}, | ||
'funktion': function(t) { | ||
return _simple(t[hasInfo? 2 : 1]) + '(' + _composite(t[hasInfo? 3: 2]) + ')'; | ||
'braces': function(t) { | ||
return t[hasInfo? 2 : 1] + _composite(t, hasInfo? 4 : 3) + t[hasInfo? 3 : 2]; | ||
}, | ||
'important': function(t) { | ||
return '!' + _composite(t) + 'important'; | ||
'atrules': function(t) { | ||
return _composite(t); | ||
}, | ||
'interpolatedVariable': function(t) { | ||
return (syntax === 'scss' ? '#\{$' : '@{') + _t(t[hasInfo? 2 : 1]) + '}'; | ||
'atruler': function(t) { | ||
return _t(t[hasInfo? 2 : 1]) + _t(t[hasInfo? 3 : 2]) + '{' + _t(t[hasInfo? 4 : 3]) + '}'; | ||
}, | ||
'nthselector': function(t) { | ||
return ':' + _simple(t[hasInfo? 2 : 1]) + '(' + _composite(t, hasInfo? 3 : 2) + ')'; | ||
'pseudoe': function(t) { | ||
return '::' + _t(t[hasInfo? 2 : 1]); | ||
}, | ||
'percentage': function(t) { | ||
return _t(t[hasInfo? 2 : 1]) + '%'; | ||
}, | ||
'placeholder': function(t) { | ||
return '%' + _t(t[hasInfo? 2 : 1]); | ||
}, | ||
'pseudoc': function(t) { | ||
return ':' + _t(t[hasInfo? 2 : 1]); | ||
}, | ||
'pseudoe': function(t) { | ||
return '::' + _t(t[hasInfo? 2 : 1]); | ||
}, | ||
'shash': function (t) { | ||
return '#' + t[hasInfo? 2 : 1]; | ||
}, | ||
'uri': function(t) { | ||
return 'url(' + _composite(t) + ')'; | ||
}, | ||
'functionExpression': function(t) { | ||
return 'expression(' + t[hasInfo? 2 : 1] + ')'; | ||
}, | ||
'variable': function(t) { | ||
return (syntax === 'scss' ? '$' : '@') + _t(t[hasInfo? 2 : 1]); | ||
return '$' + _t(t[hasInfo? 2 : 1]); | ||
}, | ||
@@ -117,4 +99,10 @@ 'variableslist': function(t) { | ||
}, | ||
'vhash': function(t) { | ||
return '#' + t[hasInfo? 2 : 1]; | ||
'placeholder': function(t) { | ||
return '%' + _t(t[hasInfo? 2 : 1]); | ||
}, | ||
'interpolation': function(t) { | ||
return '#{' + _t(t[hasInfo? 2 : 1]) + '}'; | ||
}, | ||
'default': function(t) { | ||
return '!' + _composite(t) + 'default'; | ||
} | ||
@@ -121,0 +109,0 @@ }; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
391290
9872