-
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
svg-icon - (path: (fill: #5f6b7c)) isn't a valid CSS value #5334
Comments
You will have to include the Sass plugins Blueprint uses in order to re-compile its Sass source code. See more discussion about this in #5297 and my comment here #4032 (comment). |
@adidahiya Thanks for the answer! Still I have not managed to figure out a way around this issue. As I understand, If I can't build imported sass files I can't use the sass variables to customize components. For this to work Also Maybe I am missing something out.. any feedback appreciated. |
@adidahiya I am running into the same issue, when trying to use BlueprintJs with ViteJs, any progress or tips to work around it? |
@adidahiya I am running into the same issue, when trying to use BlueprintJs (version > 4.1.0) with React18. What blueprint css plugin are you referring to address the issue? |
This is our build script to compile our Sass sources: blueprint/packages/node-build-scripts/sass-compile.ts Lines 61 to 69 in f8415b5
Note that I don't recommend pinning yourself to version We've migrated to dart-sass and we're not going back, so I suggest trying to get your build working with the latest Blueprint if you have the time to upgrade. If you can share your experience & roadblocks along the way so the Blueprint community can learn from them, that's even better. Perhaps try the suggestion of the |
Hello, I'm experiencing the same issue. my index.scss file use blueprint, with a custom primary color.
I initially had this issue:
this problem come from a missing function: blueprint/packages/core/scripts/sass-custom-functions.js Lines 26 to 30 in df7c038
I was able to duplicate it in my webpack config, but .... the resources folder does not exists in the @blueprintjs core or icons dependency. Any clue on how I can fix this ? Thanks for your help :-) |
Hi @knalinne How did you add the function to webpack? Can you show code? |
Hello @yshterev I do not directly use webpack, I use craco. I copied the function in my config file:
As you suggest, I copied the resources folder in the root of my project and it seems to work. |
Hey! How to solve this with vite? |
With #5904, you will be able to re-use Blueprint's SVG icon inliner if you want to compile its source files: import { sassSvgInlinerFactory } from "@blueprintjs/node-build-scripts";
import sass from "sass";
const sassFunctions = {
/**
* Sass function to inline a UI icon svg and change its path color.
*
* Usage:
* svg-icon("16px/icon-name.svg", (path: (fill: $color)) )
*/
"svg-icon($path, $selectors: null)": sassSvgInlinerFactory("path/to/resources/icons", {
optimize: true,
encodingFormat: "uri",
}),
};
const inputFilePath = "...";
const result = await sass.compileAsync(inputFilePath, {
functions: sassFunctions,
// more Sass options
}); or, in webpack config (EDIT: this doesn't currently work, see #6051 (comment)): import { sassSvgInlinerFactory } from "@blueprintjs/node-build-scripts";
import sass from "sass";
const sassFunctions = {
/**
* Sass function to inline a UI icon svg and change its path color.
*
* Usage:
* svg-icon("16px/icon-name.svg", (path: (fill: $color)) )
*/
"svg-icon($path, $selectors: null)": sassSvgInlinerFactory("path/to/resources/icons", {
optimize: true,
encodingFormat: "uri",
}),
};
export default {
module: {
rules: [
{
test: /\.scss$/,
use: [
require.resolve("style-loader"),
require.resolve("css-loader"),
{
loader: require.resolve("sass-loader"),
options: {
sassOptions: {
functions: sassFunctions,
},
},
},
],
},
],
},
}; or, just use the Note that you will have to continue copying the |
Hello,
I am trying to build the sass in custom webpack setup. I get this error ☝️
It is reproducible in the example below 👇 using
create-react-app
I think it has to do with the
@vgrid/sass-inline-svg
, but I don't have anything like this locally.Is this even expected to work anymore?
Environment
Code Sandbox
Sandbox example
Steps to reproduce
main.scss
Actual behavior
Fails to compile sass
Expected behavior
Should compile without issues ... like in v3
The text was updated successfully, but these errors were encountered: