question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting incorrect path with sourcemaps, am I doing something wrong?

See original GitHub issue

I’m very new to this package, so it’s quite possible I’m doing something wrong or that it isn’t a gulp-sass issue. Any help, or a nudge in the right direction, is greatly appreciated. 😃

That said:

I’m using gulp-sass with bootstrap-sass. I’m starting with a simple SCSS file, vendor.scss:

@import "../../../node_modules/bootstrap-sass/assets/stylesheets/_bootstrap.scss";
@import "custom.scss";

My custom.scss:

body {
    background-color: pink;
}

And my gulp task:

gulp.task('css:vendor', function() {
    return gulp.src('./client/features/shared/vendor.scss')
        .pipe(sourcemaps.init())
        .pipe(sass({ outputStyle: 'compressed', sourceComments: 'map' }))
        .pipe(sourcemaps.write('.'))
        .pipe(gulp.dest('./dist'));
});

Everything builds, the resulting CSS is what I would expect, but the sourcemap is off for the style from my custom.scss. It seems to be “stuck” on the last file that was processed from bootstrap’s package:

image

Any tips or suggestions?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:15

github_iconTop GitHub Comments

4reactions
zephstercommented, Jun 6, 2016

Have you tried using outputStyle: 'compact' instead of compressed? I have the same issue when I use compressed, but changing it to compact fixes it. I haven’t found a proper solution for this issue, because I would prefer to use compressed.

1reaction
JoshMorenocommented, Feb 6, 2017

@Dellkan @MattHoneycutt I think I spoke too soon. I don’t think it’s a problem with gulp-sass anymore. I still had postcss running autoprefixer in the stream. When I commented that out and just ran gulp-sass with sourcemaps and outputStyle: 'compressed' it’s working fine.

So it seems like the problem is postcss or autoprefixer. Will update as I find out more. The bootstrap breadcrumbs issue still holds true though as it messes up libsass itself.

Read more comments on GitHub >

github_iconTop Results From Across the Web

gulp - Sourcemaps are in wrong location or have incorrect paths
in the gulp.src makes it that each matched file has the full path from the base, which then causes them to output with...
Read more >
4 Reasons Why Your Source Maps are Broken - Sentry Blog
4 Reasons Why Your Source Maps are Broken · Missing or incorrect source map directive · Missing original source files · Bad source...
Read more >
Bugsnag docs › API › React Native source map upload
Once a source map is uploaded it will only get applied to new error events. It does not get applied retroactively to existing...
Read more >
Source Maps - SurviveJS
When your source code has gone through transformations, debugging in the browser becomes a problem. Source maps solve this problem by providing a...
Read more >
Source Maps - Parcel
If you encounter incorrect mappings and want to debug these, we have built tools that can help you diagnose these issues. By running...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found