Less is compiled under Windows less

Source: Internet
Author: User
Tags install node

Introduction ----

css (cascading style sheets) is a long-standing, markup language that joins HTML is widely used in the World Wide Web. HTML is primarily responsible for the definition of document structure, and CSS is responsible for the definition of document representation or style.

principle ----

Less can be used directly on the client or on the server side. In the actual project development, we recommend using the third method, compile the less file to build a static CSS file, and apply it in the HTML document.

Client

we can use the. Less source file directly on the client, just from http://lesscss.org Download the Less.js file and add the following code to the HTML that we need to introduce the less source file:

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

Less source files are introduced in the same way that standard CSS files are introduced:

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

It is important to note that the Rel attribute is set to "Stylesheet/less" when the. less file is introduced. A more important point to note is that the less source file must be introduced before Less.js is introduced, so as to ensure that less source files are correctly compiled and parsed.

Server-Side

less on the server side is mainly the help of the less compiler, the less source file compilation to generate the final CSS file, the current common way is to use node's Package Manager (NPM) to install less, after successful installation can be in the node environment for the less source files compiled.

In the early stages of project development, we need to find ways to introduce our CSS or less files to our HTML pages or bridge files, regardless of whether we use the client or server side, less provides a feature-importing that we are familiar with. We can use this keyword to introduce the. less or. css file that we need. Such as:

@import "Variables.less";

The. Less file can also omit the suffix name, like this:

@import "Variables";

The introduction of CSS is just like the less file, except that the. css suffix name cannot be omitted.


-------------------------------------less tocompile based on node under Windows -----------------------------------

  1. Install node (operation can refer to here http://www.cnblogs.com/pigtail/archive/2013/01/08/2850486.html)

  2. Install less with NPM (NPM install less-g)

  3. In the directory node. js COMMD prompt, switch to the filename.less file directory that you want to compile, enter the instructions LESSC test.less > Test.css

  4. If successful, there will be a compiled test.less in the teset.less corresponding directory.



Less is compiled under Windows less

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.