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.
18 lines
466 B
18 lines
466 B
|
3 years ago
|
const fs = require('fs')
|
||
|
|
|
||
|
|
function transformStyle(content, options) {
|
||
|
|
return content.replace(new RegExp(`\\${options.extname.style}`, 'g'), '.css')
|
||
|
|
.replace(':host', '.' + options.shadowRootHost)
|
||
|
|
}
|
||
|
|
|
||
|
|
module.exports = {
|
||
|
|
transformStyle,
|
||
|
|
transformStyleFile(filepath, options, deps) {
|
||
|
|
if (!fs.existsSync(filepath)) {
|
||
|
|
return ''
|
||
|
|
}
|
||
|
|
deps.push(filepath)
|
||
|
|
return transformStyle(fs.readFileSync(filepath, 'utf8').toString().trim(), options)
|
||
|
|
}
|
||
|
|
}
|