css / csso-cli

Command line interface for CSSO
MIT License
133 stars 10 forks source link

Source maps use full path as filename #7

Closed zspitzer closed 5 years ago

zspitzer commented 7 years ago

It's seems source map is including full paths rather than relative files

{"version":3,"sources":["W:\test\css\index.css"],"names":[],"mappings":....

i'd expect to see

{"version":3,"sources":["index.css"],"names":[],"mappings":...

running win10

css/csso#348

Sorenjin commented 6 years ago

We use server-side post-commit hooks to deploy changes to server. Thus we add map files to git. Full path in "sources" makes work very annoying when your colleague change something in css and your working copy became partially invalid.

rgcv commented 6 years ago

I'm amazed that, about a year later, this hasn't had much attention. It's a rather important feature for users who have workflows similar to the one mentioned above, where map files are committed into VCS. This can be rather bothering since absolute paths -- meaning personal OS file tree structure is also committed into VCS -- might contain sensitive information.. Might, may not, but it is a possibility

rgcv commented 6 years ago

Here's a possible solution. Replace path.resolve with path.relative, just as is, having return relative paths with regards to the cwd to the input and/or output files.

https://github.com/css/csso-cli/blob/f79854f3c67ce6f49d0dfb72b5c23d32395e012b/index.js#L207-L215

Could be made an option, so one could optionally relativize paths and keep the absolute path alternative baked in as well.

XhmikosR commented 5 years ago

@lahmatiy any chance you could get this fixed? I'm looking into switching to csso and it seems we are hitting this issue.

lahmatiy commented 5 years ago

@XhmikosR Yes, I'll try to figure it out now.

lahmatiy commented 5 years ago

Fix shipped in 2.0.0 with other changes

XhmikosR commented 5 years ago

@lahmatiy: there's still an issue on Windows with v2.0.0:

dist\\css\\bootstrap-grid.css

I suggest that you either enable Windows testing on Travis or add AppVeyor :)