No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Conditional load of quasar variables in scss

    Help
    2
    3
    293
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • O
      oneko last edited by

      Hi, I’m trying to load quasar.variables.scss conditionally (example: each client use a different theme) and it’s getting harder… I’ve tried passing env variables with sassLoaderOptions and appendData in quasar.config.js, but it looks like only affecto to Component’s styles.

      Any idea about how to solve it?

      Thanks!

      1 Reply Last reply Reply Quote 0
      • O
        oneko last edited by

        So I’ve solved it with something like:

        extendWebpack (cfg) {
                cfg.module.rules.forEach(rule => {
                  if (String(rule.test) === String(/\.sass$/) || String(rule.test) === String(/\.scss$/)) {
                    rule.oneOf.forEach(one => {
                      one.use.forEach(use => {
                        if (use.loader === '/home/oneko/src/clientes-dev/node_modules/@quasar/app/lib/webpack/loader.quasar-scss-variables' ||
                          use.loader === '/home/oneko/src/clientes-dev/node_modules/@quasar/app/lib/webpack/loader.quasar-sass-variables') {
                          use.loader = '/home/oneko/src/clientes-dev/src/loader/loader.by-env.scss'
                        }
                      })
                    })
                  }
                })
        

        I think there is a better way, so any help to improve this will be welcomed. It could be a good Quasar feature, couldn’t be?

        dobbel 1 Reply Last reply Reply Quote 0
        • dobbel
          dobbel @oneko last edited by

          @oneko

          What do you mean with each client ?
          Client as in you have a different apps? Or are you talking about users(clients) in a single app?

          1 Reply Last reply Reply Quote 0
          • First post
            Last post