ligershark / WebOptimizer

A bundler and minifier for ASP.NET Core
Apache License 2.0
753 stars 113 forks source link

Bootstrap 5.2 and 5.3 JS and Sass do not compile. #261

Open ryanmasanz opened 1 year ago

ryanmasanz commented 1 year ago

I am using the latest build of Web Optimizer and trying to compile Sass for Bootstrap is failing minification, mainly because some variables seem to be leaking through the Sass compiler.

Examples of the errors on the top of the bundle.

/* input(2563,42): run-time error CSS1063: Expected calculation unit, found '$' input(2563,42): run-time error CSS1064: Expected calculation product, found '$' input(2563,42): run-time error CSS1065: Expected calculation sum, found '$' input(2563,42): run-time error CSS1034: Expected closing parenthesis, found '$' input(2563,42): run-time error CSS1063: Expected calculation unit, found '$' input(2563,42): run-time error CSS1064: Expected calculation product, found '$' input(2563,42): run-time error CSS1065: Expected calculation sum, found '$' input(2563,42): run-time error CSS1034: Expected closing parenthesis, found '$' input(2563,42): run-time error CSS1042: Expected function, found '$' input(2563,42): run-time error CSS1062: Expected semicolon or closing curly-brace, found '$' input(2575,40): run-time error CSS1063: Expected calculation unit, found '$' input(2575,40): run-time error CSS1064: Expected calculation product, found '$' input(2575,40): run-time error CSS1065: Expected calculation sum, found '$' input(2575,40): run-time error CSS1034: Expected closing parenthesis, found '$' input(2575,40): run-time error CSS1063: Expected calculation unit, found '$' input(2575,40): run-time error CSS1064: Expected calculation product, found '$' input(2575,40): run-time error CSS1065: Expected calculation sum, found '$' input(2575,40): run-time error CSS1034: Expected closing parenthesis, found '$'

One example line causing some errors in the Sass:

.table-group-divider {
  border-top: calc($table-border-width * 2) solid $table-group-separator-color; // stylelint-disable-line function-disallowed-list
}

Removing the calc() call makes it compile. Doesn't seem like anything odd however.

Similarly, bundling bootstraps JS has a long list of issues:

/ input(16,8-9): run-time error JS1332: Expected "from": input(16,8-9): run-time error JS1333: Expected string literal: input(16,7): run-time error JS1004: Expected ';' input(16,8-9): run-time error JS1195: Expected expression: input(16,12): run-time error JS1004: Expected ';' input(16,19): run-time error JS1004: Expected ';' input(16,24): run-time error JS1004: Expected ';' input(1524,8-9): run-time error JS1332: Expected "from": input(1524,8-9): run-time error JS1333: Expected string literal: input(1524,7): run-time error JS1004: Expected ';' input(1524,8-9): run-time error JS1195: Expected expression: * input(1524,12): run-time error JS1004: Expected ';' input(1524,19): run-time error JS1004: Expected ';' input(1524,24): run-time error JS1004: Expected ';' input(16,1-7): run-time error JS1328: Import statement must include module name: import input(937,8-15): run-time error JS1327: Multiple default exports: default input(1220,8-15): run-time error JS1327: Multiple default exports: default

Any thoughts here? I have tried both Bootstrap 5.2 and 5.3. Other Sass compilers / minifier tools are processing it just fine.

ryanmasanz commented 1 year ago

I was able to resolve the JS issue, was just including some files in the sub folders that I did not need (already were imported).

However it is just flat out failing at processing the stock bootstrap.scss still :(

brenasmith commented 1 year ago

I think this is related to the version of NUglify used in this. I was using the Visual Studio Bundler and Minifier extensions to minify Bootstrap but they also had the same errors with newest Boostrap until Nuglify was updated.

mmarinchenko commented 11 months ago

Should be fixed by #280.