Roots/Sage 10 - how to import sass variables with new bud.config.js?

It looks like you should be able to prepend the import to all of your SASS files like so as well if that’s what you are looking to do.

bud.config.js

/**
 * @typedef {import('@roots/bud').Bud} bud
 *
 * @param {bud} app
 */
module.exports = (app) => {
  app
    .tap((app) =>
          app.build.items.sass.setOptions({
            additionalData: '@import "@styles/common/variables";',
          }),
        )
  // rest of bud config
};

You can find more detail about the additionalData option here

2 Likes