Blueprint: Unable to import Blueprint 2 in LESS through webpack

Created on 31 Jan 2018  路  2Comments  路  Source: palantir/blueprint

Bug report

  • __blueprint version__: 2.0.0-beta.3
  • __webpack version__: 3.10.0

Steps to reproduce

I also posted about this here but haven't heard anything.

The聽Blueprint docs聽say to use this:

@import "~@blueprintjs/core";

However, if I try that, I get this error from webpack:

Can't resolve '@blueprintjs/core.less'

123聽deals with similar issues and a lot of people suggested using this:

@import "~@blueprintjs/core/dist/blueprint.css";

webpack doesn't like that either:

Module not found: Error: Can't resolve '@blueprintjs/core/dist/blueprint.css'

Looking in the聽dist/聽directory, I can see that there's only a JS file in there:

$ ls node_modules/\@blueprintjs/core/dist/
core.bundle.js

After some trial and error, I found that this works:

@import "~@blueprintjs/core/lib/css/blueprint.css";

But this doesn't seem right to me. Also, none of the icons are loaded via this method.

What's the correct way to do this?

documentation

Most helpful comment

Ah, okay, I don't think that's in the docs anywhere. It looks like your v2 docs don't reflect some of the changes that have been made since v1.

For posterity:

  1. Both @blueprintjs/core and @blueprintjs/icons need to be installed.
  2. In your LESS, import both Blueprint stylesheets:
@import '~@blueprintjs/core/lib/css/blueprint.css';
@import '~@blueprintjs/icons/lib/css/blueprint-icons.css';
  1. Make sure to add appropriate loaders to your webpack configuration (for LESS/CSS files and the icon fonts).

All 2 comments

Icons are not included in blueprint core anymore; there's a new package called @blueprintjs/icons.

@import "~@blueprintjs/core/lib/css/blueprint.css";

this is correct. most of the built assets moved from /dist/ to /lib/.

Ah, okay, I don't think that's in the docs anywhere. It looks like your v2 docs don't reflect some of the changes that have been made since v1.

For posterity:

  1. Both @blueprintjs/core and @blueprintjs/icons need to be installed.
  2. In your LESS, import both Blueprint stylesheets:
@import '~@blueprintjs/core/lib/css/blueprint.css';
@import '~@blueprintjs/icons/lib/css/blueprint-icons.css';
  1. Make sure to add appropriate loaders to your webpack configuration (for LESS/CSS files and the icon fonts).
Was this page helpful?
0 / 5 - 0 ratings

Related issues

ConneXNL picture ConneXNL  路  24Comments

NickyYo picture NickyYo  路  18Comments

anasbud picture anasbud  路  20Comments

vladeck picture vladeck  路  32Comments

icd2k3 picture icd2k3  路  17Comments