less/less-plugin-clean-css

Source map option not working

bdgeorge opened this issue · 3 comments

I'm finding that the --source-map option doesn't work, I'm getting the following error:

Error setting options on plugin less-plugin-clean-css
unrecognised clean-css option '--source-map'
Unable to interpret argument clean-css - if it is a plugin (less-plugin-clean-css), make sure that it is     installed under or at the same level as less

This is after doing npm install -g less then npm install -g less-plugin-clean-css

If I install clean-css and run that alone it works as expected, so cleancss tmp.css --source-map --output tmp.min.css generates a cleaned file and the map.
However running lessc tmp.less tmp.css --clean-css="--source-map --output tmp.min.css" results in the error code given above.

Other options, eg lessc tmp.less tmp.css --clean-css="--s1" work fine.

I'm using lessc@2.5.0 and less-plugin-clean-css@1.5.0

The plugin has no such option. To get the sourcemap you need to use this option for the lessc itself (plugin will inherit it automatically). There's no --output option too, as well as any other input/output/file options since the plugin works inside the compiler and all files are read/written by lessc. Run lessc --clean-css to see exact list of available options.

Thanks, got it working now - the confusion came from the deprecation warning I got after upgrading lessc The compress option has been deprecated. We recommend you use a dedicated css minifier, for instance see less-plugin-clean-css. and the following paragraph in the plugin's readme.md:

See clean-css for the available command options - the only differences are advanced and rebase which we default to false, because it is not always entirely safe.

So I went and checked out clean-css and their examples (which are all for the CLI) made it look like this plugin was acting as a wrapper to the clean-css cli command as clean-css itself has a --source-map and --output option :-)

Thanks for the quick response - all good now!

Hi bdgeorge,
...please could you provide some more step_by_step instructions bout how you did to solve this issue?... (what commands we need to execute in Ubuntu terminal for example )
Thanks in advanced,