Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source maps use full path as filename #7

Closed
zspitzer opened this issue Aug 3, 2017 · 7 comments
Closed

Source maps use full path as filename #7

zspitzer opened this issue Aug 3, 2017 · 7 comments

Comments

@zspitzer
Copy link

zspitzer commented Aug 3, 2017

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
Copy link

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
Copy link

rgcv commented Sep 3, 2018

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
Copy link

rgcv commented Sep 3, 2018

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.

csso-cli/index.js

Lines 207 to 215 in f79854f

if (!inputFile) {
inputFile = '<stdin>';
} else {
inputFile = path.resolve(process.cwd(), inputFile);
}
if (outputFile) {
outputFile = path.resolve(process.cwd(), outputFile);
}

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

@XhmikosR
Copy link
Contributor

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

@lahmatiy
Copy link
Member

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

@lahmatiy
Copy link
Member

Fix shipped in 2.0.0 with other changes

@XhmikosR
Copy link
Contributor

XhmikosR commented Dec 12, 2018

@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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants