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.

Sass content order when import CSS

See original GitHub issue
  • Laravel Mix Version: 6.0.6
  • Node Version: 15.5.0
  • NPM Version: 6.14.0
  • OS: MacOs 11.1

Description:

I’m coming from Gulp and I discover it’s possible to import CSS file directly in Sass with Laravel Mix (not possible with Sass by default). But The issue is that source order are not maintained.

Example:

@import "base";

@import "button";
@import "baguettebox.js/dist/baguetteBox.min.css";

The compiled CSS files import CSS files before Sass import. In this example bagettebox will be present before base and button. Is there a workaround to fix that?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:8

github_iconTop GitHub Comments

1reaction
thecrypticacecommented, Jan 5, 2021

Sass can’t include CSS so they import it at the beginning which is the problem here. They shouldn’t be moving the import.

1reaction
florianbouvotcommented, Jan 5, 2021

Thank a lot @thecrypticace.

Thinking again, 1 - Sass can’t include CSS so they use CSS import at beginning of file. 2 - CSS loader include the CSS

So it’s a specificity of how webpack works. It doesn’t work same on Gulp for example: I copy and rename *.css file to *.sass to a vendor folder and then I import it in my main Sass file.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Sass: @import
CSS files imported by Sass don't allow any special Sass features. In order to make sure authors don't accidentally write Sass in their...
Read more >
Sass content order when import CSS · Issue #2735 - GitHub
I'm coming from Gulp and I discover it's possible to import CSS file directly in Sass with Laravel Mix (not possible with Sass...
Read more >
reactjs - React - importing css/sass in order - Stack Overflow
I'm trying to import my css/sass files in order. Somehow my css gets messed up as my bulma framework imports, overwrites all classes...
Read more >
Sass @import and Partials - W3Schools
Sass Importing Files ... Just like CSS, Sass also supports the @import directive. The @import directive allows you to include the content of...
Read more >
Sass: The @import Directive - Vanseo Design
Sass extends the CSS @import rule so that it works with .scss and .sass files. It imports the file referenced and any variables...
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