---
title: Sass/SCSS Variables
---
There are Sass/SCSS variables built into Quasar that you can change and/or use within devland should you wish to.

> [!NOTE]
> This applies to Quasar CLI managed apps only.

## Usage

In your app's `*.vue` files or in the .sass/.scss files you can use any Quasar Sass/SCSS variables (examples: `$primary`, `$red-1`), and any other Sass/SCSS variables that you declared in your `/src/css/quasar.variables.sass` or the perfectly equivalent `/src/css/quasar.variables.scss` (depending on your favorite Sass flavour) when using Quasar CLI.

```html
<!-- Notice lang="sass" -->
<style lang="sass">
  div
    color: $red-1
    background-color: $grey-5
</style>

<!-- Notice lang="scss" -->
<style lang="scss">
  div {
    color: $red-1;
    background-color: $grey-5;
  }
</style>
```

> [!NOTE]
> You don't need to necessarily have the `/src/css/quasar.variables.sass` or `/src/css/quasar.variables.scss` files if you want to access the Quasar Sass/SCSS variables. Create one of them only if you want to customize the variables.

> [!IMPORTANT]
> When creating or deleting any of the `/src/css/quasar.variables.*` files, you will need to restart your dev server in order for it to take effect. However, when you change the content of these files it won't be necessary to also restart.

## Caveat

Quasar CLI detects if the file contains at least one '$' character, and if so, it automatically imports the Quasar Sass/SCSS variables.

If, however, you have a nested importing statement and the file from which you are importing does not contain any '$' characters, this won't work. In this case, you need to add a simple comment (`// $`) so Quasar can detect at least one '$' character:

```html
<style lang="sass">
  // $

  @import 'some-file.sass'
  // now some-file.sass can benefit
  // from Quasar Sass variables too
  // due to comment above
</style>
```

Same is required for .sass/.scss files that are included from quasar.config file > css.

## Customizing

If you want to customize the variables (or add your own) and your project does not yet have a `/src/css/quasar.variables.sass` (or `/src/css/quasar.variables.scss`) file, create one of them yourself. It doesn't matter if you pick .sass or .scss as the extension for this file. **Having one of them will provide the variables to ALL your .sass AND .scss project files (including inside of .vue files).**

You can freely override any of Quasar's variables (see next section) in those files. For convenience, if you picked Sass or SCSS when you created your Quasar project folder, these files initially contain only the brand color-related variables.

> [!TIP]
> **Performance (Quasar v2.24+ with @quasar/vite-plugin v2 / @quasar/app-vite v3.4+)**
>
> Keep your variables file limited to variable declarations only. When it contains nothing else, Quasar injects into each style block only the variables that the block actually uses (instead of all of them), which significantly speeds up Sass compilation for both dev and production builds. If the file contains anything else (mixins, functions, `@import`/`@use` of other files), everything still works, but the faster targeted injection is automatically disabled.

If you want more than to override a Quasar Sass variable, but to extend one, you can achieve it in the next way:

```scss
@use 'quasar/src/css/variables' as q;
@use 'sass:map';

$space-xxl: (
  x: 64px,
  y: 64px
);

$new-spaces: (
  xxl: $space-xxl
);

$spaces: map.merge(q.$spaces, $new-spaces);
```

> [!TIP]
> Quasar is very easy to customize without the need of tampering with the Sass/SCSS variables, so make sure that you really need to do that. Not having one of the two files will actually speed up your build while the default variables will still be supplied to .sass/.scss/.vue files.

## Quasar's CSS

Quasar's own CSS is compiled using the variables file (if it exists), but there are multiple forms (sass, scss). So there has to be a priority list for Quasar CLI:

- Does `/src/css/quasar.variables.scss` exists? Use that.
- If not, then does `/src/css/quasar.variables.sass` exists? Use that.
- If not, then use pre-compiled Quasar CSS.

## Variables list

The list is the `src/css/variables.sass` file of the installed `quasar` package (`node_modules/quasar/src/css/variables.sass`), the exact version your project builds with.
