.less
" is the extension of the Less file. It is always required to use ".Less
" extension in Less document file. LESS.js
in an HTML5 browser, it will use local storage to cache the generated CSS. However, from the developer point of view they cannot see the changes they made instantly. In order to see your changes instantly, you can load program in development and watch mode by following JavaScript<script type= "text/javascript">
less.env = "development " ;
less.watch () ;
</script>
URI's
is one of the best technique, it allows developers to avoid external image referencing and instead embed them directly into a stylesheet. Data URIs are the excellent way to reduce HTTP requests
. @ symbol
and uses a colon (:)
to assigned the particular value in the variable. It is also necessary to add a semi-colon (;)
after the value of the variable.@primarycolor: #FF7F50;
@color:#800080;
h1 {
color: @primarycolor;
}
h3 {
color: @color;
}
Mixins
facilitates you to add the set of properties from one rule-set into another rule-set
. It includes class names as its properties. Mixins can be declared as the same way as CSS style using a class or id selector. It can store multiple values and can be reused in the code whenever necessary..container {
h1 {
font-size: 25px;
color:#E45456;
}
p {
font-size: 25px;
color:#3C7949;
}
.myclass {
h1 {
font-size: 25px;
color:#E45456;
}
p {
font-size: 25px;
color:#3C7949;
}
}
}
@symbol
to declare variable.$symbol
to declare variable.Source Map Less Inline
" option represents that all the CSS files must be included into the source map. +,? , *, /
that can be operated on any color or variable. strictImports
controls whether the compiler will allow a @import
inside of either @media
blocks or other selector blocks. &combinator
concatenates nested selector with the parent selector. It is useful for Pseudo classes such as :hover
and :focus
+, – , *, /
mixins
like :.gradient
.rounded
.opacity
.box-shadow
.inner-shadow
Version.2
of SASS$ lessc styles.less
$ lessc styles.less > styles.css
less.js
using Node.js : By using the Node.js
JavaScript framework you can run the less.js
script outside the browserLess.
app (for Mac users) : Less.app
is a free tool for Mac users, this tool auto compiles them into CSS filese()
function you can escape a value so that it passes straight through to the compiled CSS, without being noticed by the LESS compiler. h2 {
&:extend(.style);
font-style: italic;
}
.style {
background: green;
}