On the advantages and disadvantages of less language

Source: Internet
Author: User

on the advantages and disadvantages of less language

Advantages:
    1. The structure is clear and easy to expand. For many of the modules of the application, especially the single-page app, often need to use selector to divide the CSS of different modules scope. If you look at all. module. Action. List A,. module. Action. List A:hover It is difficult to intuitively understand the scope of the style application;
      . module {
      . Action {
      A, a:hover {
      Styles
      }
      }
      }
      Other modules
      This is much clearer. This maintainability is bound to be much higher, for example: If you want to change the application scope of the style, add a suitable action, just change the. Action to. Action,. Action2, and pure CSS is tragic, to modify the selector of each relevant rule set.
    2. It is easy to block browser private syntax differences. This needless to say, the package of browser syntax differences in the repetition of processing, reduce meaningless mechanical labor.
    3. Multiple inheritance can be easily implemented.
      . box {
      Display:block;
      }
      . thick-bordered {
      border:5px solid black;
      }
      . notice {
      . Box;
      . thick-bordered;
      }
      This way, the subclass will synchronize updates regardless of any changes to the parent class. Some people say that it's good to write the class as "notice box thick-bordered" in HTML, but this increases the coupling between HTML and style, if there are more than one in the template. Notice will inevitably do repetitive work when modified, and in addition to the modified CSS file, The client-side cached HTML template also needs to be downloaded again. In less, if mixin is used for inheritance, there is no need to generate a useless parent style code after compilation.
    4. Fully compatible with CSS code, can be easily applied to the old project. Less just expands on CSS syntax, so old CSS code can also be compiled with less code.
Disadvantages:

1, need to compile. This is an additional expense, whether on the client or the server side.


    • Gu Yiling
      Links: https://www.zhihu.com/question/20259365/answer/14520148

On the advantages and disadvantages of less language

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.