Advertisement
Guest User

Untitled

a guest
Jul 6th, 2015
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. function processCSS(processor, input, output, fn) {
  2. function doProcess(css, fn) {
  3. function onResult(result) {
  4. if (typeof result.warnings === 'function') {
  5. result.warnings().forEach(console.error);
  6. }
  7.  
  8. fn(null, result.css);
  9. }
  10.  
  11. var result = processor.process(css, {
  12. safe: argv.safe,
  13. from: input,
  14. to: output
  15. });
  16.  
  17. if (typeof result.then === 'function') {
  18. result.then(onResult).catch(fn);
  19. } else{
  20. process.nextTick(onResult.bind(null, result));
  21. }
  22. }
  23.  
  24. async.waterfall([
  25. async.apply(readFile, input),
  26. doProcess,
  27. async.apply(writeFile, output)
  28. ], fn);
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement