-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Chrome reports bad background style for icons? Why icons are not rendered? #2976
Comments
I had this same issue as well, and I compile everything through sass-loader. This is because blueprintjs uses sass-inline-svg. to provide the To workaround this, since there was only 4 instances of
It's definitely a workaround but for what its worth, it works. |
What would be the correct command line to build this scss into CSS? I used
chokidar because it was mentioned in create react app docs. What is the
other way so that the workaround is unnecessary?
…On Thu, 27 Sep 2018, 16:25 Harman, ***@***.***> wrote:
I had this same issue as well, and I compile everything through
sass-loader.
This is because blueprintjs uses sass-inline-svg
<https://www.npmjs.com/package/sass-inline-svg>. to provide the svg-icon
function. According to
https://github.com/palantir/blueprint/blob/develop/packages/core/src/docs/classes.md#custom-namespace,
they recommend using the CSS file instead of the SASS file, but the CSS
file imposes some global stylings (body, h1-h6 and etc), so I couldn't use
it.
To workaround this, since there was only 4 instances of svg-icon, I:
1. Created a SASS map with the 4 icons that it was trying to refer to.
2. Created a function called svg-icon that takes in the sass string,
looks up the map, and then creates the url(data:image/svg+xml.... ...
with the value returned from the map)
3. If there were additional params, I filled it in manually w/ url.
It's definitely a workaround but for what its worth, it works.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#2976 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADyZVVxa0ob3bRKv1yMmLrjog4pBdkpFks5ufFMngaJpZM4W7r5Z>
.
|
@avkonst @hrgui yes you are not compiling our SCSS files properly. |
I have figured out how you build it. bluprintjs package distributive includes sass-inline-svg.js but it does not include svg icons, which are required for the build. As a result, I need to download them manually from bluprintjs git repo. Would it be possible to include the icons required for sass build into the package? |
ugh that's an awful situation... i really do not want to ship 600 svg files just for this. |
file a new issue for that request. if anything, they'll ship in the |
@hrgui |
@joshuaaron try doing what core does to compile itself: https://github.com/palantir/blueprint/blob/develop/packages/core/package.json#L24. also see bulleted notes in https://blueprintjs.com/docs/#core/classes.namespacing. if this persists, please file a new issue as this one is closed and you're lucky i saw it. |
I implemented @hrgui's workaround and thought I would share. I have a file called 'svg-icon-overrides.scss' that contains a map and an svg-icon function. I import this file before I import the blueprint SASS (not sure if the order matters). The contents of svg-icon-overrides.scss is below:
|
@mdebeus thank for this. I have migrated to this workaround and it works! Great. The only thing we need to worry about is to update the content of the workaround with new releases of the blueprintjs. How would you do and share it? |
Also, I think we should have another ticket opened, which will look after removing the workaround. As of today, I have got the impression, it is not going to be resolved. |
I have found, there is the opened ticket #3377 |
@avkonst If the icons or colors change, we'll have to update the svg-icon map with the newest data. Unless you have a better idea... |
Environment
Question
I use OverflowList component. After upgrading to 3.6.1 from earlier 3.x version, Icons for Overflow list are not rendered anymore. I have compared the difference between your example and my one. The source code of the component is identical, however background CSS is rendered differently. Could you please let me know what is not right in my setup?
Here is what I see rendered:
Here is what Chrome inspect shows for missed icons (notice incorrect background CSS property):
Here is what I see rendered for your example in the documentation:
If it is important, I use create-react-app with typescript support and build css from scss with:
My index.scss includes blueprintjs scss as the following:
I do not understand what is wrong in my setup. Could you please give me a hint?
The text was updated successfully, but these errors were encountered: