widget: css: fix @media queries parsing

This commit is contained in:
jean-emmanuel 2018-03-04 22:57:13 +01:00
parent f58051d433
commit 0dc2c030aa
2 changed files with 8 additions and 1 deletions

View file

@ -2,6 +2,8 @@
## next
- bug fixes
- widgets: css: @media queries parsing
- themes
- alt-buttons: modal font-weight & color fix

View file

@ -510,7 +510,12 @@ class Widget extends EventEmitter {
scopedCss = scopeCss(this.getProp('css'), prefix),
unScopedCss = ''
this.getProp('css').replace(/\{[^\}]*\}/g).replace(/^.*\:.*/gm, m => unScopedCss += m[m.lenght - 1] === ';' ? m : m + ';')
this.getProp('css')
.replace(/\{[^\}]*\}/g, '')
.replace(/^@media.*/gm,'')
.replace(/^.*\:.*/gm, (m) => {
unScopedCss += m[m.length - 1] === ';' ? m : m + ';'
})
if (scopedCss.indexOf('@keyframes') > -1) scopedCss = scopedCss.replace(new RegExp(prefix + '\\s+([0-9]+%|to|from)', 'g'), ' $1')
if (scopedCss.indexOf('&') > -1) scopedCss = scopedCss.replace(new RegExp(prefix + '\\s&', 'g'), prefix)