Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/vuejs/vueify

Browserify transform for single-file Vue components
https://github.com/vuejs/vueify

Last synced: about 2 months ago
JSON representation

Browserify transform for single-file Vue components

Awesome Lists containing this project

README

        

# THIS REPOSITORY IS DEPRECATED

> Note: We are concentrating our efforts on supporting webpack and rollup.

## vueify [![Build Status](https://circleci.com/gh/vuejs/vueify.svg?style=shield)](https://circleci.com/gh/vuejs/vueify) [![npm version](https://badge.fury.io/js/vueify.svg)](http://badge.fury.io/js/vueify)

> [Browserify](http://browserify.org/) transform for [Vue.js](http://vuejs.org/) components, with scoped CSS and component hot-reloading.

**NOTE: master branch now hosts version ^9.0, which only works with Vue ^2.0. Vueify 8.x which works with Vue 1.x is in the [8.x branch](https://github.com/vuejs/vueify/tree/8.x).**

This transform allows you to write your components in this format:

``` html
// app.vue

.red {
color: #f00;
}

{{msg}}

export default {
data () {
return {
msg: 'Hello world!'
}
}
}

```

You can also mix preprocessor languages in the component file:

``` vue
// app.vue

.red
color #f00

h1(class="red") {{msg}}

module.exports =
data: ->
msg: 'Hello world!'

```

And you can import using the `src` attribute:

``` html

```

Under the hood, the transform will:

- extract the styles, compile them and insert them with the `insert-css` module.
- extract the template, compile it and add it to your exported options.

You can `require()` other stuff in the `` as usual. ~~Note that for CSS-preprocessor @imports, the path should be relative to your project root directory.~~ Starting in 7.0.0, `@import` in LESS, SASS and Stylus files can be either relative to your build tool root working directory, or to the file being edited. Or one can set import paths in options.

## Usage

``` bash
npm install vueify --save-dev
browserify -t vueify -e src/main.js -o build/build.js
```

And this is all you need to do in your main entry file:

``` js
// main.js
var Vue = require('vue')
var App = require('./app.vue')

new Vue({
el: '#app',
render: function (createElement) {
return createElement(App)
}
})
```

In your HTML:

``` html
<body>
<div id="app"></div>
<script src="build.js">