icons: Icon font regression when using Vite
Hello!
I have been using icon font in Vite by simpley including 1 line in my SCSS file:
@import 'bootstrap-icons/font/bootstrap-icons';
After updating to 1.9, this is no longer working. I assume it is related to changes of font-path variables, hashes, etc. - as mentioned in #1378.
It would be super-cool to keep this compatibility.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 18 (3 by maintainers)
I am still seeing the same erratic behavior, even after upgrading to 1.10.5
Can confirm this is still an issue regarding the latest versions. Using Vite and SASS,
@import "~bootstrap-icons/font/bootstrap-icons";which includes the SASS version, does in fact break. Workaround as mentioned,@import "~bootstrap-icons/font/bootstrap-icons.css";does fix the issue.Very likely, this is related to https://github.com/vitejs/vite/issues/7651 - Vite SASS processor is unable to peoperly rebase
url()when there are variables in it (if I understand correctly).So move from (1.8.3):
to (1.9)
killed the Vite importer.
As a workaround, we can import the generated CSS like this:
It skips SASS and in plain CSS the
url()rebasing apparently works…This should be fixed in main and will be in v1.10.4.
I know this is old, so not meaning to necro, but Vite 4.x changed the default charset to UTF-8 and recommends people ensure they’re using the correct
Content-Typeheader when serving CSS, as well as having yourindex.htmlinclude the<meta charset="utf-8 />tag in your<head>, which should be default for Vite users anyway.Thread: https://github.com/vitejs/vite/issues/13676#issuecomment-1612688039
I suppose even adding
@import 'bootstrap-icons/font/bootstrap-icons.css';should be covered in the official usage documentation for people using Vite.parcel.js is failing in similar way too: https://github.com/parcel-bundler/parcel/issues/6285 except that the
.cssworkaround doesn’t seem to work