By using this site, you acknowledge that you have read and understand our Cookie policy, Privacy policy and Terms .
close

Articles about ASP.NET Core 1.x, 2.x and 3.x.

rss_feed Subscribe RSS

Background

When upgrading Bootstrap to v4.0.0 release, the bundler and minifier doesn’t work properly due to CSS variable is commonly used:

:root{--blue:#007bff;

About 26 errors will show up in the Error List with the following message:

Expected semicolon or closing curly-brace found '-'

image

The environment in my machine has the following setup:

  • VS2017 15.5.4
  • <PackageReference Include="BuildBundlerMinifier" Version="2.6.362" />

Downgrading the package to 2.5.357 doesn't fix the problem in my environment though some people mentioned it can work.

Issue Cause

This issue in BuildBundlerMinifier is caused by another issue in package NUglify:

https://github.com/xoofx/NUglify/issues/17

This issue has not been fixed yet.

It is also raised in GitHub:

https://github.com/madskristensen/BundlerMinifier/issues/295

https://github.com/madskristensen/BundlerMinifier/issues/306

Resolution or Workarounds

Temporary fix

Before this issue is fixed, you can use any of the following approaches to get it work:

  • downgrade your Bootstrap 4 version to beta versions
  • or you change your code temporarily not to minimize bootstrap CSS4 file. You can still bundle and minify your other CSS files which are not using CSS variables.
  • or temporarily manually modify your Bootstrap 4 CSS file to remove that :root section if you are not using bower or other package managers to install those client packages.


I will keep this post updated when the issue is fixed permanently.

info Last modified by Raymond at 4 months ago * This page is subject to Site terms.

info About author

More from Kontext

local_offer asp.net core 2 local_offer asp.net core local_offer dotnetcore local_offer open-banking

visibility 194
thumb_up 0
access_time 12 months ago

I’ve just started an asp.net core 2.2 based implementation for Australia Consumer Data Standards (published by Data 61). Opening Banking initiative will follow these standards. The purpose is to help you to get familiar with these standards, especially the APIs that need to be implemented. ...

open_in_new View

comment Comments (3)

comment Add comment

Please log in or register to comment. account_circle Log in person_add Register
R
Raymondarrow_drop_down

Hello,

This should has been fixed now according to the issues trackers on GitHub. If you are still encountering this problem, please report to the project site on GitHub.

BTW, I've migrated to use Gulp to package my client resources. Refer to the following page for more details:

Migrate from Bower to Gulp for Client Libraries Management in ASP.NET Core


format_quote

person G Swanson access_time 4 months ago
Re: ASP.NET Core 2 with Bootstrap 4 Bundler Minifier Issue: Expected semicolon or closing curly-brace found '-'

I am still getting the problem. What do I need to upgrade to fix it?

I am using Visual Studio 2019 and most of my nuget packages are pretty recent.

reply Reply
account_circle G Swanson

I am still getting the problem. What do I need to upgrade to fix it?

I am using Visual Studio 2019 and most of my nuget packages are pretty recent.


reply Reply
Kontext Column

Kontext Column

Created for everyone to publish data, programming and cloud related articles. Follow three steps to create your columns.

Learn more arrow_forward
info Follow us on Twitter to get the latest article updates. Follow us