I'm trying to build a project where I get an error in the build:
Error: Undefined operation "10 % !important".
╷
82 │ width: #{($i * 10)}% !important;
│ ^^^^^^^^^^^^^^^^^^^^^^^^
╵
This is where I have the error:
And this is the error I'm getting:
I'm not familiar with SASS so I don't know what is wrong with the code above.
How can I solve this ?
Edit:
This is how I build sass files:
import dartCompiler from 'dart-sass';
import sass from "gulp-sass";
sass.compiler = dartCompiler;
...
gulp.task("sass", () => {
return (
gulp.src([
src_sass_folder + "*.scss",
src_sass_folder + "**/*.scss"
], {
since: gulp.lastRun("sass"),
})
.pipe(dependents())
.pipe(filter(['**'].concat(partials)))
.pipe(debug({title: "sass-debug:", showCount: false}))
.pipe(sourcemaps.init())
.pipe(plumber({errorHandler: reportError}))
.pipe(sass({ fiber: Fiber }))
.pipe(autoprefixer())
.pipe(minifyCss({debug: true}, (details) => {
console.log(`Original size: ${details.stats.originalSize}, Minified size: ${details.stats.minifiedSize}, Efficiency: ${details.stats.efficiency}`);
}))
.pipe(sourcemaps.write("."))
.pipe(gulp.dest(dist_folder + "Content"))
.pipe(browserSync.stream({match: '**/*.css'}))
);
});
And after removing the !important
I still get the build error:
Error: Expected expression.
╷
82 │ width: #{($i * 10)}%;
│ ^
╵
This is only resolved when I remove the %
.
I should also mention that this issue is only reproducible when using dart-sass as a compiler instead of the deprecated node-sass compiler according to this:
https://github.com/sass/node-sass/issues/2952
Edit2:
I think I resolved the caused issue by changing the line width: #{($i * 10)}% !important;
to width: #{($i * 10)'%'} !important;
, but I'm still having issue in the generated css, it looks like this:
.u-width-60pc__xs{
width:60 %!important;
}
Notice the space between 60
and %