Less should be compiled still under development?

5

My question came up after read this question and its answers .

Many IDEs provide ways to compile LESS code still in development. In Netbeans, for example, you can always set up the .less code to be saved, compiled, and generated in CSS. In projects I need to use some preprocessor I create a structure similar to this:

/assets
  /style
    /css
    |  style.css
    /less
      /build
         style.less
      | variables.less
      | mixins.less

When the style / less / build directory code is saved, a .css file is automatically created in / style / css .

Then, in HTML, just reference the location of the style sheets, for example:

<link rel="stylesheet" href="assets/style/css/style.css"/>

For me this would be the best way, instead of letting this processing be done on the client device I would need:

  • Download the LESS file
  • Download the script that compiles this code (suppose you have several other scripts to download as well)
  • Compile code and transform into CSS
  • Show CSS
  • I'm just using LESS, but I only see this practice being advantageous if by chance a LESS file is lighter than a CSS (and look there).

    So, my doubts:

    • Is a .less file lighter than .css ?
    • When compiling the code on the user's computer is the best choice?
    • What benefits / harms I have when I choose to compile .less client side?
    asked by anonymous 12.12.2014 / 22:50

    1 answer

    7

    Compile the Less file while in development is the scheduler option. I'd rather compile (grunt do it alone for me). So, even in development, I use CSS, not the Less files. In production, no doubt the CSS file should be distributed, not the Less.

    Answers to your individual questions:

    1. A Less file is not lighter than a CSS because it needs to be compiled.

    2. No. It could be that the user's browser wants to support files in Less and then your site would appear "broken."

    3. I believe no benefit. For mischief, see items 1 and 2 .

        
    12.12.2014 / 23:14