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

    How to access SASS variables in script?

    Help
    sass variables
    1
    1
    502
    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.
    • J
      jym last edited by

      Hi folks,
      is it possible to access a variable defined in the style part of a Vue Component in its script.
      Let’s say I have:

      <style lang="sass">
      $one: #f80939
      ...
      </style>
      

      Could I somehow do this (in the same file):

      <script>
      export default {
        methods: {
          someMethod () {
            let color = this.$style.one
            // do something with color 'one' here ...
          }
        }
      }
      </script>
      

      I know there is the css module option in vue:
      https://vue-loader.vuejs.org/guide/css-modules.html#usage

      Is this the way to go?
      I’m not sure how I would configure this in Quasar with SASS and everything.

      Can anyone help?

      Best,
      jym

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