Your country

Tools that support it use your country for local currency, number formats, units and paper size. Your choice is saved only in this browser.

Type a name or a two-letter code. Use the up and down arrow keys to move through the countries, Enter to choose one and Escape to close.

CSS Module 19

Sass modules, migrating off @import and Sass in production interview questions

Interview questions on sass modules, migrating off @import and Sass in production: warm-ups, then what each harder question tests and how a good answer starts.

9 questions: 3 warm-ups and 6 with model answers · Levels: Fresher to senior

Warm-up questions

Short questions with short answers, each answered in full.

  1. Fresher to mid

    What is the difference between @use and @import in Sass?

    Answered in the lesson Sass modules: @use, @forward and configuration

  2. Fresher to mid

    Why is Sass deprecating @import, and when will it stop working?

    Answered in the lesson Migrating Sass from @import to modules

  3. Fresher to mid

    When would you still choose Sass over native CSS today?

    Answered in the lesson Sass in production and when to use native CSS

Questions with model answers

What each question tests, the first step of a good answer and the follow-ups to expect.

  1. Mid to senior

    Twelve product teams load your design system's Sass with @use "ds" as *, and several of them call helpers you never meant to publish. A release renamed one helper and broke four apps. How would you make the library's public API explicit, and how would you roll the change out without breaking the teams again?

    What it tests
    Designing a Sass module API with an index file, show and hide, prefixes and private members, and changing a shared library safely with deprecation warnings and semantic versioning.
    First step
    Find out what the apps use today: compile each one against the library and list the members it reaches, or search their sources for the library's names. That list is the public API. Everything else becomes private, with a leading - in its file, or package-private, hidden from the index, and the index forwards the public members with explicit show lists.
    Follow-ups

    From the lesson Sass modules: @use, @forward and configuration

    Model answer, Pro. Model answers open with any pass; prices are in the notice on this page.

    Opening the model answers with your pass…

    Model answers open with any MySmartCoPilot pass.

    • Pro pass · 1 week₹79$2.99
    • 30 days₹179$5.99
    • 1 year₹1,699$45

    One payment; nothing renews unless you choose to. The price shown is the total you pay: no fees or charges are added at checkout.

    It also opens every other in-depth part in Learn and every Pro tool. Sales are final, except where the law gives you a right to withdraw, for example in the EU and the UK (refund policy).

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 4 minutes
  2. Mid to senior

    Your build needs a light and a dark stylesheet from one Sass library. A teammate loads the library twice in one entry file with two with clauses and gets "This module was already loaded, so it can't be configured using with". Explain the error, design two setups that work, and say which you would ship.

    What it tests
    One configuration per module and compilation, theming with separate entry points against CSS custom properties, and choosing by when the theme is decided.
    First step
    Explain the rule first: Sass evaluates a module once per compilation and fixes its configuration at the first load, so a second with clause has nothing left to configure. Then ask when the theme is chosen, when the site is built or while the page is open, because that decides between two compilations and custom properties.
    Follow-ups

    From the lesson Sass modules: @use, @forward and configuration

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 4 minutes
  3. Mid to senior

    A 300-file Sass codebase prints over 2,000 deprecation warnings per build, most of them from a vendored framework. Plan a migration that blocks new deprecated code from the first day while the team migrates over several sprints, and say how you would prove that each step changed no CSS.

    What it tests
    Separating your warnings from a dependency's, quietDeps and fatal deprecations in CI, staged sass-migrator runs, byte comparison against a pinned baseline, and planning the work across a team.
    First step
    Measure before changing anything: compile every entry point in verbose mode with a logger that counts warnings by deprecation ID and by origin, your files against the vendored ones. Pin the Sass version and keep the compiled CSS of every entry point as the baseline. That gives the real size of the job and a way to prove each step.
    Follow-ups

    From the lesson Migrating Sass from @import to modules

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 4 minutes
  4. Mid to senior

    After a migration to @use, the compiled CSS differs from the baseline by a handful of lines. How do you find out whether the migration caused it, and which behaviours of the module system can change the output on their own?

    What it tests
    Debugging a migration with diffs and replays, version pinning, and the module-system behaviours that change output: extend scope, meta.load-css() and parent selectors, configuration order, and colour functions.
    First step
    Rule out the toolchain first: check that the baseline and the new build used the same Sass version and the same output style, then expand both files and diff them. Trace each changed rule to its source file, and replay the migration one step at a time against the baseline to find the step that introduced the change.
    Follow-ups

    From the lesson Migrating Sass from @import to modules

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 4 minutes
  5. Mid to senior

    A Vite project compiles 140 SCSS entry files, the CSS step takes most of a slow CI build, and the team wants it faster. What do you measure first, and what would you change, in what order?

    What it tests
    Which Sass package Vite loads, the async and sync APIs, duplicated work through additionalData and repeated framework compiles, and proving a speed-up with measurements.
    First step
    Measure before changing anything: check which Sass package Vite actually loads, time a cold build and the CSS step on its own, and count how often the heavy stylesheets, such as a framework or a token module, are compiled across the 140 entry files. The largest cost decides the first change.
    Follow-ups

    From the lesson Sass in production and when to use native CSS

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes
  6. Mid to senior

    A dependency update moves Sass from 1.78.0 to 1.105.1, and the compressed CSS of your customised Bootstrap grows by about 5 KB with no change to your source. How do you decide whether the update is safe to ship?

    What it tests
    Pinning and isolating compiler upgrades, diffing expanded output, telling serialisation changes from changes in meaning, and testing the risky kinds in browsers.
    First step
    Isolate the change: one commit that only moves the Sass version, then compile with both versions in the same output style, expand both files and diff them. Sort every changed line by kind, such as a colour written another way or a changed value, before judging any of them.
    Follow-ups

    From the lesson Sass in production and when to use native CSS

    Model answer, Pro.

    In the answer:

    • Model answer
    • Follow-up answers
    • Common mistakes
    • Rubric
    • Variants
    • about 3 minutes

All CSS interview questions · The CSS track

Quick answers and tool search

Type to search tools or to get a quick answer, for example 18% of 2500. Use the up and down arrow keys to move through the results, Enter to choose, and Escape to close.