diff options
author | 2021-03-30 10:37:04 -0600 | |
---|---|---|
committer | 2021-03-30 10:37:04 -0600 | |
commit | 7334a550d8e042ae0dc59519149df2b3ad04f058 (patch) | |
tree | 1189d03d55a553a0732e1a43865e122a4055f369 /src/compiler/optimize | |
parent | ee6ef81cf38acc357141143319addf39a99d3e19 (diff) | |
download | astro-7334a550d8e042ae0dc59519149df2b3ad04f058.tar.gz astro-7334a550d8e042ae0dc59519149df2b3ad04f058.tar.zst astro-7334a550d8e042ae0dc59519149df2b3ad04f058.zip |
Fix nested parens bug (#39)
Diffstat (limited to 'src/compiler/optimize')
-rw-r--r-- | src/compiler/optimize/postcss-scoped-styles/index.ts | 8 | ||||
-rw-r--r-- | src/compiler/optimize/styles.ts | 1 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/compiler/optimize/postcss-scoped-styles/index.ts b/src/compiler/optimize/postcss-scoped-styles/index.ts index 7949f63b5..a4afd99aa 100644 --- a/src/compiler/optimize/postcss-scoped-styles/index.ts +++ b/src/compiler/optimize/postcss-scoped-styles/index.ts @@ -50,7 +50,13 @@ export function scopeSelectors(selector: string, className: string) { // leave :global() alone! if (value.startsWith(':global(')) { - ss = head + ss.substring(start, end).replace(':global(', '').replace(')', '') + tail; + ss = + head + + ss + .substring(start, end) + .replace(/^:global\(/, '') + .replace(/\)$/, '') + + tail; continue; } diff --git a/src/compiler/optimize/styles.ts b/src/compiler/optimize/styles.ts index 6f0cd9361..fa32445ba 100644 --- a/src/compiler/optimize/styles.ts +++ b/src/compiler/optimize/styles.ts @@ -205,7 +205,6 @@ export default function ({ filename, fileID }: { filename: string; fileID: strin // 3b. Update <style> attributes const styleTypeIndex = styleNodes[n].attributes.findIndex(({ name }: any) => name === 'type'); if (styleTypeIndex !== -1) { - console.log(styleNodes[n].attributes[styleTypeIndex]); styleNodes[n].attributes[styleTypeIndex].value[0].raw = 'text/css'; styleNodes[n].attributes[styleTypeIndex].value[0].data = 'text/css'; } else { |