parser: add support for "&" self selector
This commit is contained in:
parent
5d288848f3
commit
9f5def635b
1 changed files with 6 additions and 2 deletions
|
|
@ -185,7 +185,11 @@ module.exports.widgets = function(data,parent) {
|
|||
|
||||
css = css.replace(/[;\}]*([^\;\{]*\{[^\}]*\})/g, (m)=>{
|
||||
if (m[0]==';') m = m.substr(1,m.length)
|
||||
scopedCss += '${id}' + m
|
||||
if (m[0]=='&') {
|
||||
scopedCss += m
|
||||
} else {
|
||||
scopedCss += '& ' + m
|
||||
}
|
||||
return ''
|
||||
})
|
||||
|
||||
|
|
@ -212,7 +216,7 @@ module.exports.widgets = function(data,parent) {
|
|||
// apply scoped css
|
||||
if (scopedCss.length) {
|
||||
widgetContainer.attr('id', 'widget-' + widgetInner.hash)
|
||||
scopedCss = scopedCss.split('${id}').join('#widget-' + widgetInner.hash + ' ')
|
||||
scopedCss = scopedCss.split('&').join('#widget-' + widgetInner.hash)
|
||||
widgetContainer.prepend(`<style>${scopedCss}</style>`)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue