Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deleting rules from the stylesheet #370

Open
PopeOnARope opened this issue Mar 14, 2018 · 0 comments
Open

Deleting rules from the stylesheet #370

PopeOnARope opened this issue Mar 14, 2018 · 0 comments

Comments

@PopeOnARope
Copy link

I have a rare use case where I need to be able to import stylesheets on the fly to update font-face values so the user can view the app with different branding:

// React Component

insertRule(`@import url('${uri}')`);

========================================================

//font-face file

@font-face {
	font-family: 'CustomFont';
	src: url('./CustomFont.svg') format('svg');
	font-weight: 400;
	font-style: normal;
}

Note the relative Url paths in the font-face file, which is why we need to do it this way.

This works fine the first time, but if the user wants to suddenly switch the theme, then we need to insert another @import statement into the style sheet. Currently, @import statements are automatically inserted at the top of the stylesheet. However, since our goal is to reset the font-face value, we either need the ability to delete the existing @import statement or insert the new @import statement after the existing one so the newer one will be applied.

Is this possible to do with glamor, or are there plans to add this functionality in the future? Or is there a more obvious solution that I am unaware of?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant