CSS Order Changed for @import Statements
-
First, I love Autoptimize. But I have run into a snag recently.
I’m using @import statements in my theme style.css to include other CSS files in the theme directory (for organization). I have “Aggregate CSS-files” and “Also aggregate inline CSS” checked. My understanding is that the order of the CSS is intended to be maintained when aggregated. However, I’m seeing that the CSS from the @import statements is at the very top of the aggregated file. Oddly enough, the rest of the style.css file is in the place I would expect (after the parent theme CSS). I would expect the @import CSS to be just above the theme style.css since it is imported at the top of the theme style.css. But it is far above everything else instead (including the parent theme CSS).
Here’s a visual of the order without Autoptimize:
* parent_theme.css
* style.css (contains @import statements)Here’s a visual of the order with Autoptimize (all aggregated into one file):
* CSS from @import statements
* parent_theme.css
* style.css (just the rest of the file, not the @imports)I’ve only noticed this change in order to be a problem recently, but it’s possible that it was working before because of a random fluke.
Is this working as intended? It would be nice to be able to keep the order of the @import statements during aggregation.
- The topic ‘CSS Order Changed for @import Statements’ is closed to new replies.