Remove LESS // comments on compile

前端 未结 4 652
心在旅途
心在旅途 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:25

    Adding the -x option to your lessc compile command will minify the CSS, which should strip out comments. In the event it doesn't you can get more control over the minification options by using the YUI CSS compressor by adding the --yui-compress option to your compile command, which definitely strips out comments.

    Like Raphael said in his answer // style comments should not be present in compiled CSS anyway so your question doesn't make a lot of sense in the first place.

    All of this information is clearly stated on the LESS homepage / documentation, so maybe you should just read that first.

提交回复
热议问题