How to use .less file in nuxt js
Since Nuxt2 is still using Webpack4, you need to install the v7 of less-loader
(v8 is using Webpack5)
yarn add less-loader@^7 less
Then, create a .less
file somewhere, like /assets/css/myfile.less
And use it in nuxt.config.js
with this
export default { css: ['~/assets/css/myfile.less'],}
The key to use here is css
, it's the same for SCSS, SASS, Less, Stylus and so on, as shown in the documentation: https://nuxtjs.org/docs/2.x/features/configuration#the-css-property