natemoo-re / astro-icon

Inline and sprite-based SVGs in Astro made easy!
https://astroicon.dev
Other
1.01k stars 57 forks source link

` [astro-icon]` styling in a scoped component fails with `Unknown word` #37

Closed ran-dall closed 1 year ago

ran-dall commented 2 years ago

Inputting any css styles with [astro-icon] on a scoped component fails...

src/components/my-component

<style>
...
  [astro-icon] {
      color="white";
    }

...
</style>

ERROR

 error   /mnt/site/src/components/my-component.astro?astro&type=style&lang.css:8:7: Unknown word
    at Input.error (/mnt/site/node_modules/postcss/lib/input.js:148:16)
    at Parser.unknownWord (/mnt/site/node_modules/postcss/lib/parser.js:540:22)
    at Parser.other (/mnt/site/node_modules/postcss/lib/parser.js:164:12)
    at Parser.parse (/mnt/site/node_modules/postcss/lib/parser.js:72:16)
    at parse (/mnt/site/node_modules/postcss/lib/parse.js:11:12)
    at new LazyResult (/mnt/site/node_modules/postcss/lib/lazy-result.js:133:16)
    at Processor.process (/mnt/site/node_modules/postcss/lib/processor.js:28:14)
    at compileCSS (/mnt/site/node_modules/vite/dist/node/chunks/dep-8f5c9290.js:37635:10)
    at async transform (/mnt/site/node_modules/vite/dist/node/chunks/dep-8f5c9290.js:37186:55)
    at async preprocessStyle (file:///mnt/site/node_modules/astro/dist/vite-plugin-astro/compile.js:44:24)
stramel commented 1 year ago

@ran-dall It appears that you have an error in your styling.

<style>
    [astro-icon] {
-       color="white";
+       color: white;
    }
</style>
stramel commented 1 year ago

I'm going to close this since it appears to be an error in syntax used. I'm willing to open this if more details are provided and it proves to be an issue with the library.