Skip to content

Add config to silence Sass @import Deprecation Warnings #568

@jonrandahl

Description

@jonrandahl

Sass @import Deprecation Warnings

Definition of done:

  • Add config.sass.silence_deprecations = ['import'] to config/application.rb

What's happening?

Dart Sass has deprecated @import in favour of @use and @forward. These warnings appear during asset compilation but do not affect the build output — CSS is still generated correctly.

Source of the warnings

The warnings come from two places:

  1. Our own SCSS files (can be migrated)

    • app/javascript/stylesheets/application.scss — uses @import for local partials
    • app/javascript/stylesheets/_gov_uk.scss — uses @import for local and vendor styles
  2. Third-party dependencies (cannot be migrated by us)

    • govuk_frontend_toolkit — GOV.UK legacy toolkit (no longer maintained)
    • govuk-elements-sass — GOV.UK legacy elements (deprecated)

Why we're silencing these warnings

We've added the following configuration to the other LR apps to suppress these warnings:

config.sass.quiet_deps = true
config.sass.silence_deprecations = ['import']

This is the recommended approach per Sass documentation when:

  • You depend on third-party libraries that haven't migrated yet
  • The migration to @use/@forward is planned but not immediate

Is this safe?

Yes, for now. The warnings are informational — @import still works in Dart Sass 1.x and 2.x. It will only be removed in Dart Sass 3.0.0, which has no release date yet.

Future action required

When we're ready to fully migrate (likely when we move away from the legacy toolkit), we'll need to:

  1. Replace @import with @use and @forward in our own SCSS files
  2. Replace the govuk_frontend_toolkit and govuk-elements-sass dependencies

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions