apeman-react-head
Version:
apeman react package for head component.
221 lines (158 loc) • 6.29 kB
Markdown
apeman-react-head
==========
<!---
This file is generated by ape-tmpl. Do not update manually.
--->
<!-- Badge Start -->
<a name="badges"></a>
[![Build Status][bd_travis_shield_url]][bd_travis_url]
[![Code Climate][bd_codeclimate_shield_url]][bd_codeclimate_url]
[![Code Coverage][bd_codeclimate_coverage_shield_url]][bd_codeclimate_url]
[![npm Version][bd_npm_shield_url]][bd_npm_url]
[![JS Standard][bd_standard_shield_url]][bd_standard_url]
[bd_repo_url]: https://github.com/apeman-react-labo/apeman-react-head
[bd_travis_url]: http://travis-ci.org/apeman-react-labo/apeman-react-head
[bd_travis_shield_url]: http://img.shields.io/travis/apeman-react-labo/apeman-react-head.svg?style=flat
[bd_travis_com_url]: http://travis-ci.com/apeman-react-labo/apeman-react-head
[bd_travis_com_shield_url]: https://api.travis-ci.com/apeman-react-labo/apeman-react-head.svg?token=
[bd_license_url]: https://github.com/apeman-react-labo/apeman-react-head/blob/master/LICENSE
[bd_codeclimate_url]: http://codeclimate.com/github/apeman-react-labo/apeman-react-head
[bd_codeclimate_shield_url]: http://img.shields.io/codeclimate/github/apeman-react-labo/apeman-react-head.svg?style=flat
[bd_codeclimate_coverage_shield_url]: http://img.shields.io/codeclimate/coverage/github/apeman-react-labo/apeman-react-head.svg?style=flat
[bd_gemnasium_url]: https://gemnasium.com/apeman-react-labo/apeman-react-head
[bd_gemnasium_shield_url]: https://gemnasium.com/apeman-react-labo/apeman-react-head.svg
[bd_npm_url]: http://www.npmjs.org/package/apeman-react-head
[bd_npm_shield_url]: http://img.shields.io/npm/v/apeman-react-head.svg?style=flat
[bd_standard_url]: http://standardjs.com/
[bd_standard_shield_url]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg
<!-- Badge End -->
<!-- Description Start -->
<a name="description"></a>
apeman react package for head component.
<!-- Description End -->
<!-- Overview Start -->
<a name="overview"></a>
<!-- Overview End -->
<!-- Sections Start -->
<a name="sections"></a>
<!-- Section from "doc/guides/01.Installation.md.hbs" Start -->
<a name="section-doc-guides-01-installation-md"></a>
Installation
-----
```bash
$ npm install apeman-react-head --save
```
<!-- Section from "doc/guides/01.Installation.md.hbs" End -->
<!-- Section from "doc/guides/03.Usage.md.hbs" Start -->
<a name="section-doc-guides-03-usage-md"></a>
Usage
---------
Render head tag with meta tags.
```jsx
'use strict'
import React from 'react'
import {ApHead} from 'apeman-react-head'
const ExampleComponent = React.createClass({
render() {
return (
<html>
<ApHead charset="utf-8"
title='foo'
icon='./favicon.png'
meta={ {'description': 'This is description.'} }
version='1.0.0'
css={ ['css/lib.css', 'css/app.css'] }
js={ ['js/lib.js', 'js/app.js'] }
globals={ {
appProps: {/* ... */}
} }
>
<meta name="example-child-elm"/>
</ApHead>
<body>
</body>
</html>
)
}
})
```
Results like:
```html
<html>
<head class="ap-head">
<meta class="ap-head-meta" charset="utf-8"/>
<title class="ap-head-title">foo</title>
<meta name="description" content="This is description."/>
<link rel="icon" href="./favicon.png?v=1.0.0"/>
<script type="text/js" src="js/lib.js?v=1.0.0"></script>
<script type="text/js" src="js/app.js?v=1.0.0"></script>
<link rel="stylesheet" type="text/css" href="css/lib.css?v=1.0.0"/>
<link rel="stylesheet" type="text/css" href="css/app.css?v=1.0.0"/>
<meta name="example-child-elm"/>
</head>
</html>
```
<!-- Section from "doc/guides/03.Usage.md.hbs" End -->
<!-- Section from "doc/guides/04.Components.md.hbs" Start -->
<a name="section-doc-guides-04-components-md"></a>
Components
-----
### ApHead
**Props**
| Name | Type | Default | Description |
| ---- | ---- | ------- | ----------- |
| charSet | string | 'utf-8' | | CharSet |
| title | string | | | Document Title |
| icon | string | | | Favicon |
| meta | arrayOf|object | | | Meta data |
| itemProps | arrayOf|object | | | Micro data settings |
| css | array | | | CSS file urls |
| js | array | | | JS file urls |
| version | string | 'unknown' | | Version string |
| versionKey | string | 'v' | | Query string key for version |
| globals | object | | | Global variables |
| viewPort | object | {
width: 'device-width',
initialScale: '1.0'
} | | View port settings |
| base | string | null | | Base url |
| baseTarget | string | undefined | | Target of base url. '_blank', '_parent', '_self', '_top' or frame name |
| manifest | string | | | Path of manifest.json |
| color | string | | | Theme color |
<!-- Section from "doc/guides/04.Components.md.hbs" End -->
<!-- Section from "doc/guides/04.Props.md.hbs" Start -->
<a name="section-doc-guides-04-props-md"></a>
Props
-----
| Name | Type | Default | Description |
| ---- | ---- | ------- | ----------- |
| charset | string | null | Charset value. |
| title | string | null | Title value. |
| icon | string | null | Favicon file path. |
| meta | object | null | Meta values. |
| css | array | null | Css file urls. |
| js | array | null | Js file urls. |
| version | string | 'unknown' | Version number. |
| versionKey | string | 'v' | Key of version in query string. |
<!-- Section from "doc/guides/04.Props.md.hbs" End -->
<!-- Sections Start -->
<!-- LICENSE Start -->
<a name="license"></a>
License
-------
This software is released under the [MIT License](https://github.com/apeman-react-labo/apeman-react-head/blob/master/LICENSE).
<!-- LICENSE End -->
<!-- Links Start -->
<a name="links"></a>
Links
------
+ [apeman][apeman_url]
+ [apeman-react-labo][apeman_react_labo_url]
+ [React][react_url]
+ [Demo of apeman-react-head][demo_of_apeman_react_head_url]
[apeman_url]: https://github.com/apeman-labo/apeman
[apeman_react_labo_url]: https://github.com/apeman-react-labo
[react_url]: https://facebook.github.io/react/
[demo_of_apeman_react_head_url]: http://apeman-demo-labo.github.io/apeman-react-head/demo/demo.html
<!-- Links End -->