-
Notifications
You must be signed in to change notification settings - Fork 25
HelixUI with VueJS
Ryan Johnson edited this page Feb 3, 2020
·
2 revisions
- Latest stable NodeJS (for the
npm
andnpx
command-line utilities) -
helix-ui
v0.18.0 or later
(all paths are relative to the root of the project directory)
- Your app was bootstrapped via
@vue/cli
- Your app is a greenfield app (brand new codebase)
- Vendor assets live in
public/vendor/
(coded by 3rd party)
npm install helix-ui vendor-copy
-
vendor-copy
allows you to automatically copy bundled assets to your project afternpm install
.
Include the following configurations:
{
"scripts": {
"postinstall": "vendor-copy"
},
"vendorCopy": [
{
"from": "node_modules/helix-ui/node_modules/@webcomponents/webcomponentsjs/webcomponents-loader.js",
"to": "public/vendor/webcomponents-loader.js"
},
{
"from": "node_modules/helix-ui/node_modules/@webcomponents/webcomponentsjs/bundles",
"to": "public/vendor/bundles"
}
]
}
Run the following to copy files configured via the vendorCopy
configuration, above.
npx vendor-copy
NOTE: You may also want to verify that your postinstall
script is working as expected, by running npm install
.
Add the following to the bottom of the <head>
element:
<!-- Required for HelixUI to function in older browsers -->
<script src="vendor/webcomponents-loader.js"></script>
Change the contents of src/main.js
from:
import Vue from 'vue'
import App from './App.vue'
Vue.config.productionTip = false
new Vue({
render: h => h(App),
}).$mount("#app")
to this:
import Vue from 'vue'
import App from './App.vue'
import 'helix-ui/dist/css/helix-ui.min.css'
import HelixUI from 'helix-ui'
Vue.config.productionTip = false
// ignore HelixUI custom elements
Vue.config.ignoredElements = [ /^hx-/ ]
const app = new Vue({
render: h => h(App),
})
HelixUI.initialize().then(() => {
app.$mount('#app')
})
-
FYI: nesting a
<div>
within a<p>
seems to break data binding in VueJS 2.5- (codepen example)
- trying to track down the reason why this breaks
- To be continued...
TBD...