-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
Support raw imports directly to string; useful for inline css #2004
Comments
Importing css is considered applying styling, so there's no way to really do this... we can't even add an exclusion. We are going to consider importing text (into a var) from I believe your use case (and everyone's, going forward) would be best solved by #1944, which would allow you to write There is more discussion that needs to be done on this topic, so please follow #1944 for updates. 😄 If you need an immediate solution, create a file like so: export default `I need
this
as text
`; |
@Timer thanks, I ended up writing a script that wrapped all the styles in an export just like that :) |
@Timer : Great! And thank you! I have stumbled into this Git while I was looking for a way to import base64 imgs into React. Nothing seems to work because doing (having, here, the base64 string) I've tryed a lot of img base64 NPM related ('react-image-file', 'base64-img', 'react-file-base64' etc.) but nothing seemed to work.... exactly because React was giving a hand, virtual detroying the string. So... how would I import a string into my Component without React knowing what it's for...? And you gave me the answer! Passing plain texto down, then I know how HTML reproduces a base64 file! Thank you! |
I'm developing a chrome extension using react-app and would like to style the content_script with scss. The content_script doesn't allow you to load resources, they all have to be inlined.
Currently, there's no way that I know of to import the contents of a file directly into a variable; your webpack config will only provide the path to the file. Even if I convert the compiled css file into a txt file, it still only provides the path.
What we need is the ability to import a file's contents into a variable so that it can be put directly between <style></style> tags.
Is this supported and I'm overlooking it?
The text was updated successfully, but these errors were encountered: