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.

Autoprefixer is causing problems with sourcemaps when imports are wrapped in a class

See original GitHub issue

Basically if you have autoprefixer and imports that are wrapped by a class :

.random-class {
    display: flex;
    @import "box";
    @import "inbox";
}

Instead of getting : image

I am getting this : document_-_chromium_portable_2017-07-19_14-07-19

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:16 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
phatedcommented, Mar 7, 2019

@stephenbe you still need the other code, just remove the sourcemap part like:

var gulp = require("gulp");

gulp.task("css", function() {
  var sass = require("gulp-sass");
  var postcss = require("gulp-postcss");
  var sourcemaps = require("gulp-sourcemaps");
  var autoprefixer = require("autoprefixer");
  var filter = require("gulp-filter");

  return gulp
    .src("./test.scss", { sourcemaps: true })
    .pipe(sass().on("error", sass.logError))
    .pipe(gulp.dest("./", { sourcemaps: '.' }))
    .pipe(filter("./*.css"))
    .pipe(postcss([autoprefixer({ browsers: ["last 1 major versions, last 3 Chrome versions, ie 11"] })]))
    .pipe(gulp.dest("./"));
});
1reaction
phatedcommented, Mar 7, 2019

@stephenbe Awesome!!! Thanks for posting your solution. In the above example, you can totally just use the built-in sourcemap support in gulp4 and it should work wonderfully. Check out the docs: https://gulpjs.com/docs/en/api/src#sourcemaps

Read more comments on GitHub >

github_iconTop Results From Across the Web

Problem with gulp-sass ? Or gulp-autoprefixer ? Or ... - GitHub
I think gulp-autoprefixer is making a correct sourcemap between it's input/output css files. gulp-sourcemaps and gulp-sass don't seem to be the issue either....
Read more >
gulp-autoprefixer not working, gulp-sass output style,
Autoprefixer is causing problems with sourcemaps when imports are wrapped in a class #324. There is a conflict with gulp-sourcemaps and gulp-sass glob....
Read more >
Autoprefixer is causing node-sass source map to point to the ...
For anyone who needs it I found a fix. Basically, postcss has an option to detect a previous source map and use it...
Read more >
Getting started - Bootstrap
Bootstrap uses Autoprefixer to deal with CSS vendor prefixes. If you're compiling Bootstrap from its Less/Sass source and not using our Gruntfile, ...
Read more >
Speeding Up Tailwind CSS Builds - nystudio107
TL;DR for Shawn is that we can split up our CSS into separately imported chunks, so that we're not processing the massive tailwindcss/utilities ......
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