Skip to content

@import statements (such as those used for google fonts aren't positioned at the top of the css) #785

Description

@akaspick

Expected behavior

When using Sprockets 3.x, any @import statements used for @import'ing other css would be placed at the top of the compiled css. This is required according to the spec: https://developer.mozilla.org/en-US/docs/Web/CSS/@import

An @import rule must be defined at the top of stylesheet, before any other at-rule (except @charset and @layer) and style declaration, else it will be ignored.

Actual behavior

Using Sprockets 4, the @import statements are left in the location they are found in the file compilation order, so they can end up anywhere in the final compiled CSS.

System configuration

  • Sprockets version 4.20
  • Ruby version 3.2.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions