Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports = function(src) {
var urls = Parser.parse('root', src, {urls: []}).urls;
var i = urls.length;
var result = [];
while (i--) {
result.push(JSON.stringify(src.substr(urls[i].idx + urls[i].path.length)));
result.push(' + require("' + urls[i].path + '") + ');
src = src.substr(0, urls[i].idx);
}
result.push(JSON.stringify(src));
result.reverse();
return result.join('');
};