The merge feature of Less enables you to merge property values into a list under a single property. Each list can be either space-separated or comma-separated. The merge feature can be useful to define a property that accepts a list as a value. For instance, the background accepts a comma-separated list of backgrounds.
For this recipe, you will need a text editor and a Less compiler. In Chapter 1, Getting to Grips with the Basics of Less, you can read how to use and install the less.js
client-side or command-line lessc
compiler.
Create a file called
defaultfonts.less
that contains the following Less code:.default-fonts() { font-family+: Helvetica, Arial, sans-serif; } p { font-family+: "Helvetica Neue"; .default-fonts(); }
Compile the
defaultfonts.less
file from step 1 using the following command in the console:lessc defaultfonts.less
Inspect the CSS code output on the console after compilation and you will see that...