-
Notifications
You must be signed in to change notification settings - Fork 381
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 disappear with Autoprefixer #106
Comments
I'm having the same problem. As a workaround, you can insert the following two lines between
A real solution would be nice but I don't know enough about the internals to fix it myself. |
Alright, I'm aware of the issue. I'll need to dig into how gulp-less is handling sourcemaps differently. Probably won't be able to do this before the weekend. It's like bug whack-a-mole with all the changes in nodesass these days. |
Seems to work for me with the above config. I don't know if the problem is that you don't pipe .sass and .autoprefixer? Check out the comment on npmjs: |
Have you checked that the gulp-sass sourcemap is valid? In Devtools it links to your .scss file but does it provide correct line number or just null/last line of file? In my case I've tracked it down to libsass writing an incorrect sourcemap, the mappings on the .scss file is fine but not the output .css file. This will be fixed with libsass 3.2 :) So possibly not gulp-sass at fault here. Can read more here |
Yeah, it also doesn't provide the correct line number for me. I use Autoprefixer via PostCSS, but when I add it, sourcemap points to a non-existing file, Those are the two issues I have. I hope they will get resolved with libsass 3.2. |
Issue resides with libsass or node-sass |
After updating to 2.0.0, sourcemaps don't work anymore when using Test case: unic@a88d747
While this looks like an issue with autoprefixer, it did not occur before the update. /cc @sindresorhus @ai Any ideas? |
@backflip try also |
Very strange, in most previous issues, |
Exactly the same result with I'm beginning to suspect that Before autoprefixer:
After autoprefixer:
The |
@backflip can you help me a little. Can you please build CSS + map files before and after Autoprefixer. Just in archive. I will look at them in source map visualizer. Maybe maps was broken (like with Sorry, I can built them right now. |
Update: Enabling the Before autoprefixer:
After:
|
Using .pipe(tap(function(file) {
console.log(file.contents.toString());
console.log(file.sourceMap);
})) |
file.sourceMap here:
file.sourceMap here:
|
|
The map which is returned here looks like this:
|
Both looks like normal. But in Sass there is a missing part in |
@backflip can you change your Sass source? Make it more easy. Maybe there is some code that produce this error. For example, let’s test on simple example |
Simplified example A:inheritance.scss:
includes/_cats.scss:
Sourcemap before autoprefixer:
Sourcemap after autoprefixer:
Simplified example B:inheritance.scss:
Sourcemap before autoprefixer:
Sourcemap after autoprefixer:
|
O_o seems like some issue in |
@w0rm maybe you can helps us here too? |
Hm, if I write the sourcemaps in between (as indicated in this comment above), it seems to work all of a sudden (it did not when I started testing):
Before autoprefixer:
After autoprefixer:
I will do some further testing tomorrow to reproduce the situation where the intermediate writing did not help. |
@backflip seems like it is really issue from |
@floridoo: By any chance, do you have an idea what might be going on here? |
Update: In my project where I initially discovered the issue, removing the |
https://github.com/dlmanning/gulp-sass/blob/master/index.js#L77 this should equal |
The following modifications fixed this test for me: sassFileSrc = file.relative; // <--- changed this line
// Replace the stdin with the original file name
sassMap.sources[sassMap.sources.indexOf(sassMapFile)] = sassFileSrc;
// Replace the map file with the original file name
sassMap.file = gutil.replaceExtension(sassFileSrc, '.css'); // <--- changed this line |
@backflip I'm glad that it worked. Dealing with gulp sourcemaps related bugs is always such a pain, I guess vinyl-sourcemaps-apply could be more verbose about mismatched sources. |
I still experience this issue. Steffens workaround solves it for now though. Dependencies:
Gulp task:
|
@Benjaminsson have you tried gulp-postcss with autoprefixer-core instead of gulp-autoprefixer? |
@w0rm Yes, tried both with same result. |
@Benjaminsson can you create a test project that reproduces this issue? |
If I run the following, I get source maps.
However, when I introduce Autoprefixer, the source map files disappear in DevTools.
I don't think I can put the blame on Autoprefixer because when I use it in the same way as above with gulp-less or standalone, the source maps don't disappear as when I use it with gulp-sass.
The text was updated successfully, but these errors were encountered: