Octicon component for Vue.js, using inline SVG.
This project is a proof of concept for pure frontend inline SVG icons.
Vue-Octicon is built upon Octicons v3.5.0
and depends on Vue.js v1.0.17
+.
Just download dist/vue-octicon.js
and include it in your HTML file:
<script src="path/to/vue-octicon/dist/vue-octicon.js"></script>
$ npm install vue-octicon
$ bower install vue-octicon
<!-- basic -->
<octicon name="repo"></octicon>
<!-- with options -->
<octicon name="sync" scale="2" spin></octicon>
<octicon name="comment" flip="horizontal"></octicon>
<octicon name="repo-forked" label="Forked Repository"></octicon>
var Vue = require('path/to/vue')
// requiring the UMD module
var Octicon = require('path/to/vue-octicon/dist/vue-octicon')
// or with vue-loader you can require the src directly
var Octicon = require('path/to/vue-octicon/src/components/Octicon.vue')
// register component to use
require.config({
paths: {
'vue-octicon': 'path/to/vue-conticon/dist/vue-octicon'
}
})
require(['vue-octicon'], function (Octicon) {
// register component to use...
})
The component class is exposed as window.VueOcticon
.
$ npm i
$ npm run dev
Open http://localhost:8080/demo
to see the demo.