https://github.com/rgladwell/wcs-microdata
Polymer mixin to support microdata properties
https://github.com/rgladwell/wcs-microdata
polymer polymer-mixin polymer2 webcomponents
Last synced: 3 months ago
JSON representation
Polymer mixin to support microdata properties
- Host: GitHub
- URL: https://github.com/rgladwell/wcs-microdata
- Owner: rgladwell
- License: mit
- Created: 2018-02-05T20:36:31.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-07-08T11:15:15.000Z (almost 5 years ago)
- Last Synced: 2025-02-13T10:24:18.787Z (4 months ago)
- Topics: polymer, polymer-mixin, polymer2, webcomponents
- Language: HTML
- Size: 993 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# wcs-microdata [](https://travis-ci.org/rgladwell/wcs-microdata)
Web components mixin to support microdata properties.
To install wcs-microdata run the following:
```sh
> npm install wcs-microdata --save
```You can then decorate your custom elements as follows:
```js
import { MicrodataMixin } from '../wcs-microdata.js'
import { LitElement, html } from 'lit-element'class MyMicrodataElement extends MicrodataMixin(LitElement) {
static get is() { return 'my-microdata-element' }
static get properties() {
return {
name: {
type: String
}
}
}render() {
return html`${this.name}`
}
}customElements.define(MyMicrodataElement.is, MyMicrodataElement)
```
You can then populate your element properties using microdata syntax as follows:
```html
my-name
```
This should render as:
```html
my-name
```## Hacking
To modify `polymer-microdata` you need the following installed:
* [Node](https://nodejs.org/en/download/package-manager/)
* [Polymer CLI](https://github.com/Polymer/tools/tree/master/packages/cli#installation)Once you've cloned the repo run the following shell commands:
```shell
> npm install
```You can run the tests as follows:
```shell
> npm test
```Or you can run the test suite in your browser by running `polymer serve --open` and copy-and-pasting `http://127.0.0.1:8081/components/polymer-microdata/test/` into your address bar.