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.

@Mixin code not getting vendor prefixes

See original GitHub issue

The following is simplified, but roughly my code looks like this:

Current input:

#container {
  @include align-children;
}
@mixin align-children {
  & > * {
    position: relative;
    top: 50%;
    transform: translateY(-50%);
  }
}

Current output:

#container > * {
  position: relative;
  top: 50%;
  transform: translateY(-50%);
}

Am I doing something incorrectly here? I know that having the following:

#container {
  & > * {
    position: relative;
    top: 50%;
    transform: translateY(-50%);
  }
}

works fine with Autoprefixer as the vendor prefixes are all there.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
eliasyleecommented, Apr 11, 2017

If Autoprefixer doesn’t work with @mixin and @include, this sounds perfectly like an Autoprefixer issue.

But regardless, I was under the impression that Sass pre-processes CSS files and removes at-rules before Autoprefixer comes in sees:

#container > * {
  position: relative;
  top: 50%;
  transform: translateY(-50%);
}

Is this not the case?

0reactions
aicommented, Apr 11, 2017

Just put PostCSS (Autoprefixer is PostCSS plugin) after Sass. In this case Autoprefixer will work with CSS.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Adding vendor prefixes with LESS mixin - Stack Overflow
The autoprefix plugin add browser prefixes leveraging the autoprefixer postprocessor. For client side compiling (in the browser) you can use -prefixfree.
Read more >
Mixin to Prefix Properties - CSS-Tricks
In case you're interested in handling your own CSS vendor prefixing (rather than, say, Autoprefixer or Compass), here is a mixin to help ......
Read more >
Sass Guidelines
An opinionated styleguide for writing sane, maintainable and scalable Sass.
Read more >
SCSS prefix mixin - CodePen
Insecure Resource. The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https....
Read more >
Documentation | U.S. Web Design System (USWDS)
If JavaScript fails users will still get a robust HTML foundation and all the ... like gulp-autoprefixer automatically add vendor prefixes to CSS...
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