container-query-polyfill icon indicating copy to clipboard operation
container-query-polyfill copied to clipboard

Local CSS Imports

Open Z33 opened this issue 3 years ago • 5 comments

Hey there, I'm dealing with a legacy system so I've opted to use the IIFE version. However, It's now throwing the following error on my stylesheets containing local imports.

Uncaught (in promise) Error: (styles.css): Advanced beyond the end

Removing the imports resolved the issue and allowed the script to do its job once more. I can look into alternative methods to my CSS imports, but hopefully I can find a way to resolve this without restructuring everything.

Z33 avatar Jan 10 '22 20:01 Z33

Are you talking about @import? Because yes, I totally did not add support for that. Can you give me a small code sample that breaks?

surma avatar Jan 11 '22 11:01 surma

I think I have a hint. Blocks when adding a ccs file with @import OR with :root {--whatever}. Then I have another problem: doesn't work with CSP, beacaus of blob:URL

speciale avatar Jan 12 '22 15:01 speciale

So I tried to recreate this outside of my other environment and all seems fine with the import. I need to look more into this come Monday.

https://codepen.io/ThomasDaugherty/project/editor/AMQRLd

Z33 avatar Jan 13 '22 21:01 Z33

I managed to find a moment. So I've updated that pen above to include a quick toggle to help showcase the issue.

Success: good.css, Includes styling for the card module, Includes :root, Zero imports. Failure: bad.css, Only imports good.css

Z33 avatar Jan 14 '22 16:01 Z33

I'm seeing the same problem with this when trying to include the IIFE. The only container query I've got on the page is included just before this script. You can see the error here: https://tim.ac-leo.com

tgardnerAC avatar Feb 01 '22 20:02 tgardnerAC

This issue should be resolved by the latest version of the polyfill (currently in alpha). Please give that a try and feel free to open a new issue if you run into further troubles.

Thank you!

devknoll avatar Aug 16 '22 16:08 devknoll