How can we use NUXT3 with sass, also please share the documentation.
I tried to add sass into nuxt3 project, but the vite looks like no options to load scss
How can we use NUXT3 with sass, also please share the documentation.
I tried to add sass into nuxt3 project, but the vite looks like no options to load scss
$ yarn add sass
# or
$ npm install sass --save-dev
// nuxt.config.ts
export default defineNuxtConfig({
// more
css: [
// SCSS file in the project
"~/assets/style/main.scss", // you should add main.scss somewhere in your app
],
})
<style lang="scss" scoped>
//...
<style/>
As in a normal vue or vite project you need to install as below
// .scss and .sass
npm add -D sass
// .less
npm add -D less
// .styl and .stylus
npm add -D stylus
But you need to define the css or scss files in nuxt.config.ts, As in the example below
css: [
// CSS file in the project
'@/assets/css/main.css',
// SCSS file in the project
'@/assets/css/main.scss'
]
© 2022 - 2024 β McMap. All rights reserved.
.sass
itself afterwards. β Rachele