Closed carloscarnero closed 4 years ago
Hey Carlos thanks for getting in touch. I confess that I'm not super familiar with this area of SASS syntax and have been meaning to look into it properly since the PR for this landed. My best guess is maybe the version of SASS you are using doesn't support this import syntax, but maybe @manuelmeister may have an idea?
@carloscarnero The sass version would be my guess as well.
I used the @use
syntax instead of the @import
syntax because sass advises doing so: https://sass-lang.com/documentation/at-rules/import
In the error message, it can't handle the namespacing.
Your version of the sass-implementation may not support this. What version does your sass-loader
have?
Your version of the sass-implementation may not support this. What version does your
sass-loader
have?
Currently I'm set with sass-loader
version 8.0.2 and the implementation is node-sass
version 4.13.1.
If you notice the opening comment, you'll see that I had
@import "~inter-ui/inter-hinted.scss";
and following @manuelmeister's suggestion about @use
vs @import
I changed the above into
@use "~inter-ui/inter-hinted.scss";
and that builds! Now, I just have to see why
@use "~inter-ui/default" as inter-ui with (
$inter-font-path: "~inter-ui/Inter (web latin)"
);
@include inter-ui.weight-400;
@include inter-ui.weight-700;
still gives the error.
EDIT: I got excited too soon. While the build succeeds, it will not process the font sources and it actually puts @use "~inter-ui/inter-hinted.scss"
into the generated CSS. What I'm going to do, is to build a reduced test case with just enough bits for Inter, as there are too many moving parts in what I currently have.
Strange. You used the @import
correctly as you did want to include the whole inter-hinted.
Please keep me updated. The problem could also be with the ~
in @use "~inter-ui/inter-hinted.scss"
I'm sorry for the inconvenience!
I have created the simplest case that closely matches what I have in production, except that only Inter is integrated. I have found that using sass
(Dart) will correctly build the assets, while node-sass
will not (with the aforementioned errors.)
Yes. I just found out that @use
is only supportet on sass-dart:
Compatibility: Dart Sass since 1.23.0, LibSass ✗, Ruby Sass ✗ Only Dart Sass currently supports @use. Users of other implementations must use the @import rule instead.
Oh! Apparently LibSass @use
support, sass/libsass#3051, is on hold waiting for sass/sass#1094 (an issue opened in 2014.) In the mean time, I'll try to migrate to sass
instead of node-sass
? Thank you all!
EDIT: FYI, I successfully migrated my production workflow to Dart (with the added convenience that one of the upstream projects that I use, Video.js, also migrated to Dart a while ago.)
Thanks for helping out here @manuelmeister. I could look into different import mechanisms if there is need, but it sounds like migration away from node-sass is a broadly good path.
Nice! @philipbelesky yes I think, it would make sense to add this to the requirements with a link to the issues that @carloscarnero mentioned.
Update: have added a note to the README
in 765bcf707b2ab814d35f37a599ca79e21c00c874
I'm using Webpack to process and use Inter and a bunch of other resources. Up to 3.12.0, I had a
.scss
file with justwhich worked as expected. Starting with 3.12.1, I'm getting this error when I run Webpack:
(
<SNIP>/src/scss/inter.scss
is my integration, where I load Inter.) I have seen that this version brought some changes, including the possibility to include specific weights, which is absolutely great. I tried the.scss
with the documented example:and got a similar error:
What am I missing?