Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Example usage with Astro? #15

Unanswered
digoburigo asked this question in Q&A
Discussion options

Hello. I would like to know if its possible to use this with the Astro framework?

You must be logged in to vote

Replies: 3 comments

Comment options

Using the is:inline directive (https://docs.astro.build/en/reference/directives-reference/#isinline) should work after importing the script.

example:

<div>
 <style is:inline>
 me {
 background-color: red;
 }
 </style>
...
</div>
You must be logged in to vote
0 replies
Comment options

One more change you need to do is adding this in your <head> so that you can avoid FOUC

 <script
 is:inline
 src="https://cdn.jsdelivr.net/gh/gnat/css-scope-inline/script.js"
 ></script>

the is:inline property is important to opt out of astro's script processing. I can make a PR to add to the README?

You must be logged in to vote
0 replies
Comment options

Gonna convert this to a discussion as it may be an ongoing thing. Kudos @AceroM for your insight as a fellow Astro user 👍 Could add a very short note about it in the Technical FAQ- but I'd generally like to avoid adding content that applies to only one framework.

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
Converted from issue

This discussion was converted from issue #13 on March 06, 2024 21:47.

AltStyle によって変換されたページ (->オリジナル) /