Make your CSS dynamic with .less
The Composite.Web.Css.Less package allows you to create and use dynamic CSS's by integrating .less (Less CSS for .NET) support on your Composite C1 website.
With .less on board you can create CSS-based .less files that support variables, operations, mixins, nested rules and functions in your style sheets. For more information on .less, please visit http://www.dotlesscss.org/.
To edit .less files, you can use one of the ad-hoc extensions for Visual Studio:
How to implement
- Install the package.
- On your website, create a file with the
.lessextension, e.g.~/Frontend/Styles/mystyles.less - Add styles as you do in CSS files with the additional .less syntax, for example:
@brand_color: #4D926F; #header { color: @brand_color; } h2 { color: @brand_color; }
Please see examples at http://www.dotlesscss.org/. - In the
Layout perspective, edit a page layout template and link it to this
.lessfile as you do for.cssfiles:
<link rel="stylesheet" href="~/Frontend/Styles/mystyles.less" type="text/css" />
Requirements
Composite C1 version 3.0 or later