Remove LESS // comments on compile

前端 未结 4 716
心在旅途
心在旅途 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条回答
  •  Happy的楠姐
    2021-02-02 10:19

    2015-July update: when trying the -x option as the other answers suggested, I got this warning:

    The compress option has been deprecated. We recommend you use a dedicated css minifier, for instance see less-plugin-clean-css.

    You can install the plugin with

    npm install -g less-plugin-clean-css
    

    Then run lessc with the --clean-css argument.

提交回复
热议问题