CSS Preprocessor--less

Source: Internet
Author: User
Tags css preprocessor

I. Overview
Less is a CSS preprocessing language, it extends the CSS language, adding variables, mixin, functions and other features, so that the CSS easier to maintain and expand.
Less can run on Node or browser side
second, less environment to build
Less can be used on the server or client side
1. Use at service end:
Install the less compilation tool: NPM install Less-g
After you install less, you can call the less compiler on the command line, as follows:
LESSC styles.less
This will output the compiled CSS code to stdout, and you can redirect the output to a file:
$ LESSC styles.less > Styles.css
To output a compressed CSS, simply add the-x option. If you want a better compression effect, you can also enable clean CSS for compression with the –CLEAN-CSS option.
Executes LESSC with no arguments and prints a list of all available options on the command line

Use less in idea (you need to install the file Watchers plugin)

2. Clients use less:
Using Less.js on the client is the easiest way to do it, and it is convenient in the development phase, but in a production environment, performance and reliability are important, and it is recommended that you use Node.js or other third-party tools for precompiling.
Add a link to the. Less style sheet in the page and set the Rel property to "stylesheet/less":

<link rel= "stylesheet/less" type= "Text/css" href= "styles.less"/>

Next, download the less.js and introduce it through the tag, placed in the element of the page:

<script src= "Less.js" type= "Text/javascript" ></script>

3. Use of less in sublime:
First you need to install LESS:NPM install-g less
You also need to install a less plugin for compressing CSS files: npm install-g less-plugin-clean-css

Then install the sublime plugin (ctrl+shift+p>install Package): syntax highlighting plug-in: less less file compilation plug-in: Less2css

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.