UNPKG

requisite

Version:
69 lines (62 loc) 1.53 kB
// Generated by CoffeeScript 1.12.4 var addBourbon, path, requireTry, resolveNpm; path = require('path'); requireTry = require('../utils').requireTry; resolveNpm = (function() { var cache; cache = {}; return function(url, file, cb) { var err; if (cache[url] != null) { return cb({ file: cache[url] }); } cache[url] = url; try { cache[url] = path.relative(process.cwd(), require.resolve(url)); } catch (error) { err = error; console.error(err); } return cb({ file: cache[url] }); }; })(); addBourbon = (function() { var bourbonPath; bourbonPath = null; return function(includePaths) { var err; if (bourbonPath == null) { try { bourbonPath = path.dirname(require.resolve('bourbon')); } catch (error) { err = error; } } if (bourbonPath) { return includePaths.concat(bourbonPath); } else { return includePaths; } }; })(); module.exports = function(opts, cb) { var includePaths, sass; sass = requireTry('node-sass'); includePaths = [path.join(process.cwd(), 'node_modules'), path.dirname(opts.absolutePath)]; includePaths = addBourbon(includePaths); return sass.render({ data: opts.source, includePaths: includePaths, outputStyle: 'nested' }, function(err, res) { if (err != null) { return cb(err); } return cb(null, "module.exports = " + (JSON.stringify(res.css.toString()))); }); }; //# sourceMappingURL=sass.js.map