Giter Site home page Giter Site logo

Comments (4)

wattanx avatar wattanx commented on June 13, 2024 1

@tibineagu
@nuxtjs/style-resources only supports webpack.

If you want to achieve the same thing with vite, use the following options
https://vitejs.dev/config/shared-options.html#css-preprocessoroptions

from style-resources.

tibineagu avatar tibineagu commented on June 13, 2024 1

@wattanx thanks for the clarification. i implemented the preprocessorOptions and it works decently well.

Thank you!

from style-resources.

wattanx avatar wattanx commented on June 13, 2024

Sorry, the README is wrong.
Nuxt 3 does not have buildModules.
Use the modules option instead.

from style-resources.

tibineagu avatar tibineagu commented on June 13, 2024

Hi @wattanx - unfortunately the module isn't working properly with nuxt 3.

Here is a reproduction repo on stackblitz:
https://stackblitz.com/edit/github-qakexa

package.json

  "devDependencies": {
    "@nuxt/devtools": "latest",
    "@nuxtjs/style-resources": "^2.0.0",
    "less": "^4.2.0",
    "nuxt": "^3.8.2",
    "vue": "^3.3.8",
    "vue-router": "^4.2.5"
  }

nuxt.config.ts

// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  css: ['@/assets/global.less'],
  modules: ['@nuxtjs/style-resources'],
  styleResources: {
    less: ['@/assets/imports/vars.less'],
  },
  devtools: { enabled: true },
});

The @text-white LESS variable defined in vars.less is not accessible in pages/index.vue - getting this error:

[plugin:vite:css] [less] variable @text-white is undefined

It also seems that the compiler doesn't warn about files listed in styleResources that don't exist (for example the non-existent-file.less).

from style-resources.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.