DEV Community

Sylvester Nkeze
Sylvester Nkeze

Posted on

How can i load sass files on nuxt with sass-loader ?

I intend loading bulma sass files from node modules into my components on nuxtjs but I am not getting any lead way. After installing both node-sass and sass-loader (coupled with the several hours I have spent trying to set them up on nuxt.config.js with zero success) I have really hit a dead end here guys, please help me.

Discussion (5)

Collapse
nathanbland profile image
Nathan Bland

Is this a fresh project you are just getting started on?
If it is, I would recommend just using create-nuxt-app, which can bundle bulma for you out of the box.

If you already have some work done, then the next step would be to include bulma in the nuxt.config.js as you mentioned. To do that, take a look at their docs on css configuration here: nuxtjs.org/api/configuration-css

If this still isn't working, something might be off with your configuration of nuxt itself.

Collapse
silverman42 profile image
Sylvester Nkeze Author

Wow, several hours of neck pain and headaches which would have been avoided if i had just done this

module.exports={
 css: ['bulma','@/assets/custom.scss']
}

Instead of

module.exports={
 css: ['~bulma/bulma','@/assets/custom.scss']
}

Thanks a lot, Nathan. You are a life saver.

Collapse
nathanbland profile image
Nathan Bland

Glad I could help!

Collapse
lynnewritescode profile image
Lynne Finnigan

Could you post your nuxt.config.js file? Just to get a better idea of what you've done so far.

Collapse
silverman42 profile image
Sylvester Nkeze Author

Thanks Lynne. The problem has been solved with help from Nathan Bland