Search code examples
asp.net-corebootstrap-4mixinsscss-mixinsadminlte

ASPNetCore 3.1 + Bootstrap Mixins not compiling


How do I include a bootstrap mixin, in an ASPNetCore project?

I have Web compiler installed. I added an scss folder and copied the alerts-variant mixing code from here:

https://martijncuppens.github.io/bootstrap-mixins-documentation/docs/4.1/mixins/#alert-variant

Then I RIGHT-CLICK -> Web Compiler -> Recompile

and the _alerts.css is empty.

Same thing happens when I use http://beautifytools.com/scss-compiler.php

What am I doing wrong?

I am using an AdminLTE project template, and I don't want to customize and recompile the entire AdminLTE+bootstrap bundle unless I absolutely have to.


Solution

  • I think you are a little confused about what a mixin is. You need to actually call it in a sass via the @import directive and that will be compiled to the css. If you do not call the mixin the scss compiler will not include it in the project as it is unnecessary. The template will not magically blend in asp.net core you will have to include all the scss and then use some razor syntax to actually mimic the examples. If you want to change the scss with new mixins you will need to call them and override the styles with specificity.