UNPKG

hem

Version:

stitches CommonJS, and ties up other lose ends of web-app development.

60 lines (46 loc) 1.12 kB
// Generated by CoffeeScript 1.5.0 (function() { var CSS, compilers, fs, resolve; resolve = require('path').resolve; fs = require('fs'); compilers = require('./compilers'); CSS = (function() { function CSS(config) { if (config == null) { config = {}; } try { this.path = require.resolve(resolve(config.path)); this.target = config.target; } catch (e) { } } CSS.prototype.compile = function() { if (!this.path) { return; } delete require.cache[this.path]; return require(this.path); }; CSS.prototype.unlink = function() { if (fs.existsSync(this.target)) { return fs.unlinkSync(this.target); } }; CSS.prototype.createServer = function() { var _this = this; return function(env, callback) { return callback(200, { 'Content-Type': 'text/css' }, _this.compile()); }; }; return CSS; })(); module.exports = { CSS: CSS, createPackage: function(config) { return new CSS(config); } }; }).call(this);