2020-11-26 22:21:55 +00:00
|
|
|
const HTMLAsset = require('parcel-bundler/lib/assets/HTMLAsset')
|
|
|
|
|
|
|
|
function shouldIgnore (file) {
|
|
|
|
// Ignore img(src="${...}") on pug & keep the components folder pristine
|
2020-12-14 10:24:35 +00:00
|
|
|
return /\${.+}/.test(file) || /components/.test(file) || /\/lib\/solid-/.test(file);
|
2020-11-26 22:21:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|