Skip to content

Make easier to use CSS custom properties in Vue components

License

Notifications You must be signed in to change notification settings

cuulee/vue-custom-properties

 
 

Repository files navigation

vue-custom-properties

Make easier to use CSS custom properties in Vue components

Installation

$ npm install --save vue-custom-properties
# or
$ yarn add vue-custom-properties

Example

  1. Install it into Vue.js.
import Vue from 'vue'
import VueCustomProperties from 'vue-custom-properties'

Vue.use(VueCustomProperties)
  1. Define customProperties option in your components.
export default {
  data() {
    return {
      color: 'red',
      size: 12
    }
  },

  customProperties: {
    '--base-color': 'color', // --base-color: red;
    '--base-size'() {
      return this.size + 'px' // --base-size: 12px;
    }
  }
}

License

MIT

About

Make easier to use CSS custom properties in Vue components

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 43.9%
  • JavaScript 37.6%
  • Vue 11.9%
  • HTML 6.6%