apeman-react-head

3.2.0 • Public • Published

apeman-react-head

Build Status Code Climate Code Coverage npm Version JS Standard

apeman react package for head component.

Installation

$ npm install apeman-react-head --save

Usage

Render head tag with meta tags.

'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:

<!DOCTYPE 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>

Components

ApHead

Props

Name Type Default Description
charSet string 'utf-8'
title string
icon string
meta arrayOf object
itemProps arrayOf object
css array
js array
version string 'unknown'
versionKey string 'v'
globals object
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 |

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.

License

This software is released under the MIT License.

Links

Package Sidebar

Install

npm i apeman-react-head

Weekly Downloads

26

Version

3.2.0

License

MIT

Last publish

Collaborators

  • okunishinishi