You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.js 503B

12345678910111213141516171819202122232425262728293031
  1. /**
  2. * Module dependencies.
  3. */
  4. var func = require('rework-plugin-function');
  5. /**
  6. * Map `url()` calls.
  7. *
  8. * body {
  9. * background: url(/images/bg.png);
  10. * }
  11. *
  12. * yields:
  13. *
  14. * body {
  15. * background: url(http://example.com/images/bg.png);
  16. * }
  17. *
  18. */
  19. module.exports = function(fn) {
  20. return func({
  21. url: function(path){
  22. path = path.split('"').join('');
  23. path = path.split('\'').join('');
  24. return 'url("' + fn.call(this, path.trim()) + '")';
  25. }
  26. }, false);
  27. };