sprockets-vue

Gem Gem

A Sprockets transformer that converts .vue file into js object.

heads up!

version 0.1.0 has incompatible changes, attempting to make the syntax work more similarly to Webpack/vue-loader.

Specifically:

  • You should assign module.exports variable to make it work! (not vm)
  • You should use VComponents instead of VCompents
  • Now supports normal javascript (as well as coffeescript)

feature

following tag is supported in .vue file

  • script (coffeescript and js)
  • template (currently html only)
  • style (scss, sass and css)

install

add gem 'sprockets-vue' to Gemfile, and run bundle, currently works with sprockets 3.

example

  • index.vue ```vue //= require components/card


* application.coffee

```coffee
#= require index

new Vue(
  el: '#search',
  components: {
    'index': VComponents.index
  }
)
  • application.scss scss //=require index

you can include .vue file in css file, it's style block will be automatic processed. you can also use require_tree to include all .vue file.😘 scoped will not be supported.

advanced