Remove LESS // comments on compile

前端 未结 4 646
心在旅途
心在旅途 2021-02-02 09:28

Is it possible to configure LESS to remove \"// comments\" when it compiles via JS?

I want to remove them from the outputted less file.

4条回答
  •  温柔的废话
    2021-02-02 10:05

    Less' single-line comments // are supposed to be silent, as per documentation states:

    Single-line comments are also valid in LESS, but they are ‘silent’, they don’t show up in the compiled CSS output:

    // Hi, I'm a silent comment, I won't show up in your CSS
    .class { color: white }
    

    See at LESS' website: http://lesscss.org/#-comments

    -x flag works on command line to output minified CSS (which will strip CSS comments), but in any way, double slash shouldn't appear on css. See http://lesscss.org/#usage at 'Command-line usage' topic.

提交回复
热议问题