hubl/internal/assets.js
2021-07-05 18:05:23 +02:00

21 lines
523 B
JavaScript

const HTMLAsset = require('parcel-bundler/lib/assets/HTMLAsset')
function shouldIgnore (file) {
// Ignore img(src="${...}") on pug
return /\${.+}/.test(file)
}
class SkipStartinbloxWidgetAsset extends HTMLAsset {
addDependency (name, opts) {
if (!shouldIgnore(opts.resolved)) {
return super.addDependency(name, opts)
}
}
processSingleDependency (p, opts) {
if (shouldIgnore(p)) return p
else return super.processSingleDependency(p, opts)
}
}
module.exports = SkipStartinbloxWidgetAsset