-
Notifications
You must be signed in to change notification settings - Fork 69
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
resolve url loader can not operate: css error #28
Comments
Looks like badly formed CSS. I have not yet known the CSS parser to be
wrong.
Temporarily remove this loader and check your CSS is valid.
|
Same thing for me. But the error is on resolve-url-loader cannot operate: CSS error
/Volumes/Workspace/ExampleProject/src/styles/example.scss:2:3: @font-face missing '}' webpack config resolve: {
alias: {
globals: PATHS.globals,
assets: PATHS.assets,
}
},
{
test: /\.scss$/,
loaders: ['style', 'css?modules&importLoaders=2&sourceMap', 'resolve-url?sourceMap', 'sass?sourceMap']
}, The file in question:
@import `~globals/font-face-mixin.scss`;
@include font-face('icomoon', '~assets/fonts/icomoon');
@function main-src($formats, $file-path, $font-family) {
// Return the list of `src` values, in order, that
// a good `@font-face` will need, including only
// those formats specified in the list `$formats`.
$result: ();
@if index($formats, eot) {
$eot-val: url('#{$file-path}.eot?#iefix') format('embedded-opentype');
$result: append($result, $eot-val, comma);
}
@if index($formats, woff2) {
$woff2-val: url('#{$file-path}.woff2') format('woff2');
$result: append($result, $woff2-val, comma);
}
@if index($formats, woff) {
$woff-val: url('#{$file-path}.woff') format('woff');
$result: append($result, $woff-val, comma);
}
@if index($formats, ttf) {
$ttf-val: url('#{$file-path}.ttf') format('truetype');
$result: append($result, $ttf-val, comma);
}
@if index($formats, svg) {
$svg-val: url('#{$file-path}.svg##{$font-family}') format('svg');
$result: append($result, $svg-val, comma);
}
@return $result;
}
@mixin font-face (
$font-family,
$file-path,
$weight: 400,
$style: normal,
$formats: eot ttf
) {
@if index('italic' 'oblique', $weight) {
$style: $weight;
$weight: normal;
}
@font-face {
font-family: $font-family;
font-weight: $weight;
font-style: $style;
@if index($formats, eot) {
src: url('#{$file-path}.eot');
}
src: main-src($formats, $file-path, $font-family);
}
} |
Found the problem. If you use @font-face {
:global {
font-family: "aven-black";
font-weight: 700;
font-style: normal;
src: url("~assets/fonts/aven-black.eot");
src: url("~assets/fonts/aven-black.eot?#iefix") format("embedded-opentype"), url("~assets/fonts/aven-black.ttf") format("truetype");
}
} So Is there a way to work around it? |
If you are using CSS modules I would have thought you could eliminate this
loader?
There are some issues like this due to historic use of rework.
They are not something I have experienced first hand. So I don't have any
guidance short of rewrite using post CSS(?).
That looks inevitable the only question is when.
Sorry I don't have more help.
|
@bholloway I tried to, by strangely it doesn't work without it either. |
@le0nik That's strange. Why would it not like the tilde? I am not sure Establish it is indeed a problem with tilde. If that is the case then try omit-tilde-webpack-plugin. |
I got it to work. I had to mention, that I was using So here's how I got it to work:
@import `~globals/font-face-mixin.scss`; // imported with tilde
@include font-face('icomoon', 'assets/fonts/icomoon'); // path without tilde. Why? I don't know. The mixin itself is in the comment above. I have absolutely no idea why this works, but it does. This kind of magic worries me :/, but at least I got it to work. |
@le0nik In I am assuming that @craigcosmo does this relate to your problem? |
Sorry @le0nik I did not re-read the history of the conversation before making my last post and it simplistically ignores the crux of the issue. I can't think why this would work like this. I am assuming that |
This "fixes" a known issue when using Tailwind with Sass (bholloway/resolve-url-loader#28). It removes the `resolve-url-loader` from the loaders for SCSS files and disables source maps. Without this change there would be a persistent warning when running `yarn start`. This change requires a change to the webpack.config.js in roots/sage. The final export needs to be: ``` module.exports = merge.smartStrategy({ 'module.loaders': 'replace' })(webpackConfig, desire(`${__dirname}/webpack.config.preset`)); ```
Please refer to #97 as version 3 may help any open issues. |
I'm going to close this ageing issue because we have a new version Please open a fresh issue for any ongoing problems and link to this one as needed. I'm not opposed to reopening this issue but certainly lets talk with respect to the new version. |
This is still an issue in v5.0.1 of mix. Trying to use sass in laravel 8 with tailwind, and i'm required to add the |
still having this issue with v3, laravel mix and tailwind, it is even worse, with v2 it was just a warning and the build worked and in v3 it is an error, the build fails. |
full error:
my webpack config
Got this since I use something called react-virtualized in my component. It works well before I use react-virtualized though.
Here is some code inside Home.js component
The text was updated successfully, but these errors were encountered: