/** * Module dependencies. */ var css = require('@adobe/css-tools'); var parse = css.parse; var stringify = css.stringify; /** * Expose `rework`. */ exports = module.exports = rework; /** * Initialize a new stylesheet `Rework` with `str`. * * @param {String} str * @param {Object} options * @return {Rework} * @api public */ function rework(str, options) { return new Rework(parse(str, options)); } /** * Initialize a new stylesheet `Rework` with `obj`. * * @param {Object} obj * @api private */ function Rework(obj) { this.obj = obj; } /** * Use the given plugin `fn(style, rework)`. * * @param {Function} fn * @return {Rework} * @api public */ Rework.prototype.use = function(fn){ fn(this.obj.stylesheet, this); return this; }; /** * Stringify the stylesheet. * * @param {Object} options * @return {String} * @api public */ Rework.prototype.toString = function(options){ options = options || {}; var result = stringify(this.obj, options); return result; };