> For the complete documentation index, see [llms.txt](https://devworkshops.gitbook.io/masteringvuejs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://devworkshops.gitbook.io/masteringvuejs/styling-the-ui/themes.md).

# Themes

## Working with Sass

Vue CLI projects come with support for pre-processors including Sass, Less, and Stylus. Since a CSS pre-processor was not selected when creating this project, you will need to manually install the corresponding webpack loaders:

```
npm install sass-loader node-sass --save-dev
```

No further configuration is required, as the internal webpack config is pre-configured to handle all pre-processors.

You can now import Sass file types, or use Sass in .vue components as follows:

```markup
<style lang="scss">
$color: red;
</style>
```

Now that Sass is enabled, we can swtich from importing **bootstrap.css** to **bootstrap.scss**. First, remove the following imports from **main.js**:

{% code title="main.js" %}

```javascript
...
import 'bootstrap/scss/bootstrap.css'
import 'bootstrap-vue/dist/bootstrap-vue.css'
...
```

{% endcode %}

Then, add a new style block to **App.vue** as follows:

{% code title="App.vue" %}

```markup
...
<style lang="scss">
@import '~bootstrap/scss/bootstrap';
@import '~bootstrap-vue/dist/bootstrap-vue';
</style>
...
```

{% endcode %}

Save all changes and ensure the site appears normally. In the following topics, you will choose a new theme and customise the sites appearance.

## Customising the theme

In order to customise the theme of the application, you will create a new **.scss** file that contains the required customisation. Within the **assets** folder, create a new file named **custom.scss**. Then update **App.vue** to import the new file:

{% code title="App.vue" %}

```markup
...
<style lang="scss">
@import './assets/custom.scss';
@import '~bootstrap/scss/bootstrap';
@import '~bootstrap-vue/dist/bootstrap-vue';
</style>
...
```

{% endcode %}

You can now customise the appearance of the site by updating the **custom.scss** file. For example, an update to the primary colour would be added as follows:

{% code title="custom.scss" %}

```css
$primary: #c0ff33;
```

{% endcode %}

A good way to get started is to review Bootstrap's **\_variables.scss** file. It contains just over one-hundred lines of Sass that would allow you to customise the entire appearance of your site.

## Choosing a new theme

There are a number of free themes available at [bootswatch.com](https://bootswatch.com/). In this section you will choose a new theme to apply to your application. Start by installing bootswatch:

```
npm install bootswatch --save
```

Next, import the relevant **.scss** files for your chosen theme. For example, if you have chosen Cosmo, update **App.vue** as follows:

{% code title="App.vue" %}

```markup
...
<style lang="scss">
@import './assets/custom.scss';
@import '~bootswatch/dist/Cosmo/variables';
@import '~bootstrap/scss/bootstrap';
@import '~bootswatch/dist/Cosmo/bootswatch';
@import '~bootstrap-vue/dist/bootstrap-vue';
</style>
...
```

{% endcode %}

Save all changes and ensure that the site is now using the chosen theme:

![](/files/-LWxaSGzKsx8Teygai6q)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://devworkshops.gitbook.io/masteringvuejs/styling-the-ui/themes.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
