Skip to content

LostCrew/vue-styletron

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vue-styletron

Travis David David npm

Styletron for Vue.js

Install

Add dependency

npm install vue-styletron --save or yarn add vue-styletron

Initialize plugin

import VueStyletron from 'vue-styletron'

Vue.use(VueStyletron)

Usage

Define style in data, use v-style in template

new Vue({
  el: '#el',
  data: {
    style: {
      el: {
        color: 'white'
      }
    }
  }
  template: '<div v-style="el">White text</div>'
})

// Styletron generated style:
// .a {
//   color: white
// }

// Vue rendered template:
// <div class="a">White text</div>