Powerriegel
Powerriegel

Reputation: 627

lessc Option --source-map-rootpath seems not to work

I use lessc 2.7.3. I generate css files via a makefile and use following paths

My problem is that css files misses the themes/bodensee path, so it raises a file not found on css.map files.

lessc -s less/wlb.less --clean-css="--s0 --advanced" --source-map-rootpath=themes/bodensee/ --source-map="css/wlb.css.map" css/wlb.css

The CSS file now contains `sourceMappingURL=css/wlb.css.map``The rootpath does not have any effect.

I also tried a fantasy rootpath and searched for it in the file - it does not appear anywhere. But the option is correct. When I try to missspell the option, LESS drops an error.

What am I missing?

Description of the --source-map-rootpath option from here

Specifies a rootpath that should be prepended to each of the less file paths inside the sourcemap and also to the path to the map file specified in your output css.

Because the basepath defaults to the directory of the input less file, the rootpath defaults to the path from the sourcemap output file to the base directory of the input less file.

Use this option if for instance you have a css file generated in the root on your web server but have your source less/css/map files in a different folder. So for the option above you might have

Upvotes: 1

Views: 199

Answers (1)

Powerriegel
Powerriegel

Reputation: 627

The problem was indeed related to the Clean-CSS plugin.

I now call lessc --source-map --clean-css="--s0 --advanced" -s less/wlb.less css/wlb.css which is working.

There is a standalone clean-css program, but that does not generate sources for the Less files. It's not clear if the lessc plugin and the standalone tool are the same or different implementations but both use node.

The standalone cleancss tool removes the source map URL generated by lessc be default (did not play around with the dozens of options).

These Node tools develop very fast and manual/tutorials often are outdated. That's why my make file stopped working. Developers of that tools should really consider not to touch working parameters or features and to keep their code compatible.

Upvotes: 2

Related Questions