-
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
First-class support for @import'ing blueprint scss files #123
Comments
I got this error as well as I use webpack. I tried also with dist css file:
with .scss file I get same error as parent. There needs to be official docs how to use the library with the webpack loaders. Webpack should be perfect tool for this, since it should be able to pack all the resources in blueprint without me adding lines to the html file. |
I propose to change the title of bug "how to use this with webpack" |
@Ciantic It does work with the generated @import "~@blueprintjs/core/dist/blueprint.css"; Your error is because you don't have a loader configured to handle Edit - Updated to Webpack 2 config style: {
test: /\.(woff|woff2)$/,
use: {
loader: 'url-loader',
options: {
name: 'fonts/[hash].[ext]',
limit: 5000,
mimetype: 'application/font-woff'
}
}
}, {
test: /\.(ttf|eot|svg)$/,
use: {
loader: 'file-loader',
options: {
name: 'fonts/[hash].[ext]'
}
}
} Make sure you have
|
@dmackerman I'm getting the same error with tilde also:
I threw the @import inside my scss file. Maybe it's conflicting with something else. PS. I also have file loader in place:
|
@dmackerman sorry, I didn't read your post throughly. Now it works as I threw more stuff you said there. Though I think this should be documented in the blueprint, webpack is probably most common way to pack the apps these days. |
Agreed. At the very least importing the SCSS files should work. Just seems like a dependency issue in the package. Will keep an eye on this. |
thanks @dmackerman for explaining webpack usage. users will need to install the appropriate loaders in order to import the CSS in webpack. as for SCSS usage, one missing import should be easy enough to install locally as a workaround. we'll move |
No problem @giladgray. I can work up a quick PR for the docs. |
I'm now also experimenting with SCSS file in webpack. Bourbon is not the only problem. If I include the scss file: I get bunch of other errors, one: the paths to bourbon are relative to wrong directory. Second, the resources are missing so icons don't compile. |
Here is how to get it working until the project is fixed to work with SCSS importing:
To your SCSS file in webpack project. P.S. I think all SCSS variables should be defined with !default: Edit Added 2. step, forgot it |
This thread has a handful of good suggestions; I'm going to rename it to be more accurate -- I think its scope should be more than simply "make the bourbon import work". |
This was super helpful. Please consider adding a section in the Blueprint docs about usage with webpack. |
after some deliberation, it seems that adding worth noting that most components do use alias variables for all their coloring. we're not 100% on this practice but we're close enough that you should be able to customize most things without touching the colors themselves. |
closing this as #377 has merged! feel free to re-open or file new issues if future sass issues arise. |
I'm still struggling with this problem after trying most of the suggestions in this thread. For reference, I have 1.6 installed. At first, I was having a problem with bourbon not resolving. Eventually I figured out that Now, when I include the following in my @import "~@blueprintjs/core/src/blueprint" Webpack produces the following for each of the files in
My webpack loaders are nothing special: [{
test: /\.s(a|c)ss$/,
loader: ExtractTextPlugin.extract({loader: ['css-loader', 'sass-loader']})
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract({loader: 'css-loader'})
},
{
test: /\.(jpg|gif|png|svg|woff|woff2|eot|ttf)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'file-loader', options: {name: '[name].[ext]'}
}] I'm still a bit of a webpack noob and haven't been able to figure out a way to work around this problem. |
@derekharmel You have to update the icon path before you import it.
|
Doh! Thanks @dmackerman! I had tried that before, but apparently not after, figuring out the bourbon issue. |
to anyone following, installing cheers.
|
I'm using
It's the first time I found it so difficult to import a sass into a project, I don't fully understand the use of import with tilde That said, thanks for this great open source! |
@mtt87 step 1 shouldn't be necessary. just add a dev dependency on bourbon that matches blueprint's: blueprint/packages/core/package.json Line 25 in 6fcf038
anyway, we're going to remove the bourbon dependency completely in the near future #875 |
@adidahiya to be honest that way doesn't work, I just tried. Glad you are removing the bourbon dependency 😄 |
@mtt87 we use |
@giladgray worked like a charm 😄 |
@mtt87 I am trying to use |
@condemil Sure, this is my setup $icon-font-path: "~@blueprintjs/core/resources/icons";
@import "../node_modules/@blueprintjs/core/src/blueprint";
@import "../node_modules/@blueprintjs/datetime/dist/blueprint-datetime.css";
...
"scripts": {
"start-js": "react-scripts start",
"start": "npm run start-js",
"build": "npm run build-css && react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"deploy": "./deploy.sh",
"build-css": "node-sass src/ -o src/ --importer=node_modules/node-sass-package-importer/dist/cli.js",
"watch-css": "npm run build-css && node-sass src/ -o src/ --importer=node_modules/node-sass-package-importer/dist/cli.js --watch --recursive"
} I'm not sure (haven't coded on that project recently) but I think I had to run the |
Hmm, why it works just fine for me when using webpack and this: Is the new issue when using without webpack? For me it works with simply above in webpack. |
@Ciantic you are importing the css we are importing sass for a custom build. |
Thanks @Ciantic @condemil @mtt87 I'm using create-react-app. When I tried to follow the docs and put
in one of my .css files, I got errors. Including from index.html didn't work. But then I had success putting this in my .css:
|
First, thanks for the long thread and tips found in here. I was having the same error using |
@Sigfried Hm.. I just tried it with a fresh install of |
@lhlmgr your css path is wrong for version 2.0. try |
@giladgray thanks for your fast response and the info! Unfortunately it is still |
ah then the error is probably that |
Hm, its the same behaviour when using the line |
did you try inspecting the DOM node, not the react element? don't know what to tell you, and this issue is closed. |
Given this import:
Webpack is throwing an error
The path to
../node_modules/bourbon/app/assets/stylesheets/bourbon
is invalid, asbourbon
isn't installed as a dependency because it's listed underdevDependencies
. Is this library not intended to allow users to override the variables?The text was updated successfully, but these errors were encountered: