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

Modify sourcemap paths of imported files #320

Merged
merged 4 commits into from Sep 19, 2015
Merged

Modify sourcemap paths of imported files #320

merged 4 commits into from Sep 19, 2015

Conversation

ghost
Copy link

@ghost ghost commented Jul 30, 2015

Modify sourcemap paths of imported files relative to file.base instead of relative to file, if a different base is specified. Resolves #319

…d of relative to file, if a different base is specified.
@ghost
Copy link
Author

ghost commented Jul 30, 2015

Possibly resolves #300 also.

@ghost
Copy link
Author

ghost commented Jul 30, 2015

Used path.sep to reference the platform specific separator.

@mariusGundersen
Copy link

What's the status of this? I came across this exact issue in our project, and after many hours I came up with a fix that looks a lot like this one. I can confirm that it will fix the issue in our project as well.

I think a more elegant solution is to use Array#map to fix the sources list, as it requires fewer variables. Something like this:

        sassFileSrc = file.relative;
        sassMap.sources = sassMap.sources.map(function(f){
          return f == sassMapFile
            // Replace the stdin with the original file name
            ? sassFileSrc
            // Get the path relative to base, not the original file path
            : path.join(path.dirname(sassFileSrc), f);
        });

@dometec
Copy link

dometec commented Sep 16, 2015

The PR works. Cloud you please accept this PR and release the new version?

Thanks
Domenico

@Keats
Copy link
Collaborator

Keats commented Sep 19, 2015

lgtm, @Snugug ?

Snugug added a commit that referenced this pull request Sep 19, 2015
Modify sourcemap paths of imported files
@Snugug Snugug merged commit 64d93e6 into dlmanning:master Sep 19, 2015
@Snugug
Copy link
Collaborator

Snugug commented Sep 19, 2015

Me to.

@mariusGundersen
Copy link

Great! Any chance you can push this to npm as v2.0.5?

@glen-84
Copy link

glen-84 commented Sep 24, 2015

👍

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

Successfully merging this pull request may close these issues.

6 participants