styled-vue icon indicating copy to clipboard operation
styled-vue copied to clipboard

Variables don't work in nuxt.js

Open flexscss opened this issue 6 years ago • 4 comments

I try

style: scss`
    .index {
      width: 100vh;
      height: 100vh;
      background: ${vm => vm.$store.state.theme.colors.primary};
      color: ${vm => vm.color};
    }
  `

but variables don't work screen shot 2019-02-08 at 12 48 22

flexscss avatar Feb 08 '19 09:02 flexscss

Please provide a full repro.

egoist avatar Feb 08 '19 13:02 egoist

I'm with the same problem (i'm using nuxt as well)

style: css`
    .container2 {
      background-color: ${vm => vm.backgroundColor};
    }
  `,
  data() {
    return {
      backgroundColor: 'red'
    }
  },

but the browser just put a

background-color: var(--v0);

I've tried the example that is on the documentation and it doesn't work either. Also the Preprocessors doesn't work (I have sass-loader and node-sass installed):

ERROR in ./pages/teste.vue
Module Error (from ./node_modules/eslint-loader/index.js):

/home/arthurvdiniz/dev/sites/acervus-publico/pages/teste.vue
  9:10  error  scss not found in 'styled-vue'  import/named

✖ 1 problem (1 error, 0 warnings)

souavds avatar Feb 28 '19 14:02 souavds

@egoist Same thing here. Preprocessors won't work.

jankal avatar May 17 '19 09:05 jankal

Works fine for me. With css and scss.

Sample Repo here: https://github.com/christophwolff/nuxt-styled-vue-sample

christophwolff avatar Jan 18 '20 11:01 christophwolff