3.3.1 • Published 5 years ago

mrbuilder-plugin-html v3.3.1

Weekly downloads
130
License
0BSD
Repository
-
Last release
5 years ago

The HTML plugin allows for testing of components, and for compiling pages. It is a wrapper around HtmlWebpackPlugin.

By default looks first for a public/index.js to bootstrap your app, if it does not exist, than it uses a synthetic file that looks like

    import React from 'react';
    import {render} from 'react-dom';
    import App from 'your-module';
    render(<App/>, document.getElementById('content'))

More than likely you should write your own render component, that looks similar

Configuration

In package.json

 "name":"your_component",
 ...
 "mrbuilder":{
    "plugins":[
        "mrbuilder-plugin-html"
    ]
 }

Custom Element

To configure which element your component renders to use elementId property, where the value is the dom Id. By default it is "content".

Hot loading

Hot loading setup is always a PNA -- this attempts to make it easier, however to do this your "App" must export a class rather than the traditional export.

This can be controlled via the exported flag either per "page" or for all "pages".

Custom Hot Loading

If exported is false, than you will need to set hot loading in your page, and your running hot see step 4. The rest of the steps are already done for you.

An example can be found here;

It should look something like.

"mrbuilder":{
    "plugins":[
        ["mrbuilder-plugin-html", {exported:false}]
    ]
 }

Your entry point should look something like.

// main.js
import React from 'react'
import ReactDOM from 'react-dom'
import { AppContainer } from 'react-hot-loader'
import App from './containers/App'

const render = Component => {
  ReactDOM.render(
    <AppContainer>
      <Component />
    </AppContainer>,
    document.getElementById('root'),
  )
}

render(App)

// Webpack Hot Module Replacement API
if (module.hot) {
  module.hot.accept('./containers/App', () => {
    render(App)
  })
}

Pages

The pages points can be configured via pages object where the key will match the entry point, or by default it will look into public/index.js, failing that it will use the main defined in your package.json.

"mrbuilder":[
[
        "mrbuilder-plugin-html",
        {
          "pages": {
            "index": {//"index will match your entry for index.
              "title": "Index" // will set the title for the page.
            },
            "other": {
              "title": "Other",
              "exported": true // will tell the html plugin to create a real entry point and setup loading for this.
            }
          }
        }
      ]
]
3.3.1

5 years ago

3.3.1-alpha.0

5 years ago

3.3.0

5 years ago

3.3.0-alpha.3

5 years ago

3.3.0-alpha.2

5 years ago

3.3.0-alpha.0

5 years ago

3.2.1

5 years ago

3.2.0

5 years ago

3.1.7

6 years ago

3.1.6

6 years ago

3.1.5

6 years ago

3.1.3

6 years ago

3.1.2

6 years ago

3.1.1

6 years ago

3.1.0

6 years ago

3.0.6

6 years ago

3.0.2

6 years ago

3.0.1

6 years ago

3.0.0

6 years ago

3.0.0-0

6 years ago

2.1.1

6 years ago

2.1.0

6 years ago

2.1.0-0

6 years ago

2.0.4

6 years ago

2.0.4-5

6 years ago

2.0.4-3

6 years ago

2.0.4-1

6 years ago

2.0.4-0

6 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.0

6 years ago

2.0.0-beta.6

6 years ago

2.0.0-beta.5

6 years ago

2.0.0-beta.4

6 years ago

2.0.0-beta.3

6 years ago

2.0.0-beta.2

6 years ago

2.0.0-beta.1

6 years ago

1.2.6

6 years ago

1.2.3

6 years ago

1.2.0

6 years ago

1.1.0-0

6 years ago

1.0.3-1.0

6 years ago

1.0.3-1.1.0-0.0

6 years ago

1.0.0

6 years ago

0.9.11

6 years ago

0.9.9

6 years ago

0.9.7

6 years ago

0.9.6

6 years ago

0.9.5

6 years ago

0.9.2

6 years ago

0.9.1

6 years ago

0.8.5

6 years ago

0.8.4

6 years ago

0.8.2

6 years ago

0.8.1

6 years ago

0.8.0

6 years ago

0.7.3

6 years ago

0.7.2

6 years ago

0.7.1

6 years ago

0.7.0

6 years ago

0.4.0

6 years ago

0.3.8

6 years ago

0.3.7

6 years ago

0.3.6

6 years ago

0.3.4

6 years ago

0.3.3

6 years ago

0.3.2

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.7

6 years ago

0.1.6

6 years ago

0.1.5

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.11

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago