compiler icon indicating copy to clipboard operation
compiler copied to clipboard

Remove css print escape for experimentalStaticExtraction

Open bluwy opened this issue 1 year ago • 1 comments

Changes

Fix #502

I may be missing something big, but it doesn't seem like CSS needs to be escaped as it's not JS 🤔 I've removed it for CSS printing for static extraction

Testing

Added test to css.ts

Docs

N/A

bluwy avatar Aug 15 '22 14:08 bluwy

🦋 Changeset detected

Latest commit: ab01c33659dab97ed2c1a99d9488b73c0f749c09

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@astrojs/compiler Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Aug 15 '22 14:08 changeset-bot[bot]

Needs a changeset.

matthewp avatar Aug 17 '22 14:08 matthewp

Note to future self: Test this locally with Astro, if not possible, cut a separate publish tag.

bluwy avatar Aug 17 '22 14:08 bluwy

@matthewp I linked this locally to the Astro tests, and only found one failing test. It seems to be incorrectly tested, so this PR should still be good.

  1) CSS
       build
         Astro Styles
           HTML and CSS scoped correctly:
     AssertionError: expected '.linked-sass:where(.astro-ON5EH4HS){c…' to include '.blue:where(.astro-CXSJVMWR){color:#b…'
      at Context.<anonymous> (file:///Users/bjorn/Work/oss/astro/packages/astro/test/0-css.test.js:50:27)
      at processImmediate (node:internal/timers:466:21)
const expected = `.blue:where(.${scopedClass}){color:#b0e0e6}.color\\\\:blue:where(.${scopedClass}){color:#b0e0e6}.visible:where(.${scopedClass}){display:block}`;
expect(bundledCSS).to.include(expected);

The expected should check for \\ instead of \\\\. Can also confirm that before the bundled CSS isn't correct:

.color\\:blue:where(.astro-CXSJVMWR)

With this PR, it's:

.color\:blue:where(.astro-CXSJVMWR)

bluwy avatar Aug 18 '22 08:08 bluwy