Comparing version 0.0.37 to 0.0.38
@@ -0,1 +1,2 @@ | ||
/* version: 0.0.37 */ | ||
var Absurd = (function(w) { | ||
@@ -2,0 +3,0 @@ var lib = { |
var fs = require('fs'); | ||
var path = require("path"); | ||
@@ -31,2 +32,43 @@ module.exports = function() { | ||
// Handling CSS | ||
_api.handlecss = function(parsed, path) { | ||
var plugins = _api.getPlugins(); | ||
if(parsed && parsed.type === 'stylesheet' && parsed.stylesheet && parsed.stylesheet.rules) { | ||
var rules = parsed.stylesheet.rules; | ||
for(var i=0; rule=rules[i]; i++) { | ||
switch(rule.type) { | ||
case "rule": _api.handlecssrule(rule); break; | ||
case "import": _api.handlecssimport(rule, path); break; | ||
default: | ||
if(plugins[rule.type]) { | ||
plugins[rule.type](_api, rule); | ||
} | ||
break; | ||
} | ||
} | ||
} | ||
return _api; | ||
} | ||
_api.handlecssimport = function(rule, cssPath) { | ||
_api.import(path.dirname(cssPath) + "/" + rule.import.replace(/"/g, '')); | ||
return _api; | ||
} | ||
_api.handlecssrule = function(rule, stylesheet) { | ||
var absurdObj = {}, absurdProps = {}; | ||
if(rule.declarations && rule.declarations.length > 0) { | ||
for(var i=0; decl=rule.declarations[i]; i++) { | ||
if(decl.type === "declaration") { | ||
absurdProps[decl.property] = decl.value; | ||
} | ||
} | ||
if(rule.selectors && rule.selectors.length > 0) { | ||
for(var i=0; selector=rule.selectors[i]; i++) { | ||
absurdObj[selector] = absurdProps; | ||
} | ||
} | ||
_api.add(absurdObj, stylesheet); | ||
} | ||
return _api; | ||
} | ||
// internal variables | ||
@@ -33,0 +75,0 @@ _api.numOfAddedRules = 0; |
@@ -34,2 +34,3 @@ var requireUncached = require('../helpers/RequireUncached.js'), | ||
} | ||
return function(path) { | ||
@@ -36,0 +37,0 @@ if(typeof path == 'string') { |
{ | ||
"name": "absurd", | ||
"version": "0.0.37", | ||
"version": "0.0.38", | ||
"homepage": "https://github.com/krasimir/absurd", | ||
@@ -5,0 +5,0 @@ "description": "CSS preprocessor", |
@@ -5,7 +5,13 @@ 'use strict'; | ||
var getVersion = function(callback) { | ||
var p = require(__dirname + "/../package.json"); | ||
callback(p.version) | ||
} | ||
module.exports = function(grunt) { | ||
grunt.registerMultiTask('client-side', 'generate client-side version of the library', function() { | ||
var tmp = grunt.file.read(this.data.src, {}); | ||
var content = ''; | ||
var tmp = grunt.file.read(this.data.src, {}), | ||
content = '', | ||
self = this; | ||
@@ -26,5 +32,7 @@ content = "var Absurd = (function(w) {\n"; | ||
grunt.file.write(this.data.dest, content, {}); | ||
getVersion(function(version) { | ||
grunt.file.write(self.data.dest, "/* version: " + version + " */\n" + content, {}); | ||
}); | ||
}); | ||
}; |
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
205152
6160
106
24