Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSS modules support #5

Open
rshaibakov opened this issue Jan 17, 2019 · 1 comment
Open

CSS modules support #5

rshaibakov opened this issue Jan 17, 2019 · 1 comment

Comments

@rshaibakov
Copy link

Will there be support for css modules instead of scoped?

@egoist
Copy link
Owner

egoist commented Jan 17, 2019

Yeah I plan to add CSS modules support, it should be pretty easy.

The proposed usage: import styled-vue/modules instead of styled-vue to use CSS modules.

<template>
  <div><h1 :class="$style.title">hello there!</h1></div>
</template>

<script>
import { css } from 'styled-vue/modules'
import { modularScale } from 'polished'

export default {
  style: css`
    .title {
      /* You can access component's "this" via "vm" */
      color: ${vm => vm.$store.state.themeColor};
      font-size: ${modularScale(2)};
      margin: 0;
    }
  `
}
</script>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants