UNPKG

postcss-gtk

Version:

Processes GTK+ CSS into browser CSS

38 lines (31 loc) 850 B
// Generated by CoffeeScript 1.9.1 (function() { var postcss, valueHooks; postcss = require("postcss"); valueHooks = []; module.exports = postcss.plugin("gtk-color-variables", function() { return function(css, processor) { return css.eachDecl(function(decl) { return decl.value = module.exports.hook(decl.value, decl); }); }; }); module.exports.hook = function(value, node) { var fn, i, len, str; str = value; if (str === "") { return str; } for (i = 0, len = valueHooks.length; i < len; i++) { fn = valueHooks[i]; str = fn(str, node); if (typeof str !== "string") { throw new Error("Value hook returned " + (typeof str)); } } return str; }; module.exports.add = function(hook) { return valueHooks.push(hook); }; }).call(this);