Git Product home page Git Product logo

vue-styletron's Introduction

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>

vue-styletron's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

vue-styletron's Issues

Not typical usage

How can i use this package, if structure of my project looks like this?

Console
--index.vue
--script.js
--style.styl
--template.html

My vue file:

<style src="./style.styl" lang="stylus"></style>
<script src="./script.js"></script>
<template src="./template.html"></template>

I thought that i need something like this
<div v-style="list"> and .list {margin-top: -20px}, like css modules work, but its not.

I'm new to Vue.js, so I can not figure it out

Also, after importing this package I got an error ERROR in main.js from UglifyJs Unexpected token punc «(», expected punc «:» because You use es6 syntax

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.