wishthis/node_modules/rework-plugin-url/index.js

32 lines
503 B
JavaScript
Raw Normal View History

2022-01-21 08:28:41 +00:00
/**
* Module dependencies.
*/
var func = require('rework-plugin-function');
/**
* Map `url()` calls.
*
* body {
* background: url(/images/bg.png);
* }
*
* yields:
*
* body {
* background: url(http://example.com/images/bg.png);
* }
*
*/
module.exports = function(fn) {
return func({
url: function(path){
path = path.split('"').join('');
path = path.split('\'').join('');
return 'url("' + fn.call(this, path.trim()) + '")';
}
}, false);
};