brakmic / Inferno.js-Starter

:fire: Starter for Inferno.js, +WebPack, +Redux, +Mocha

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CarPool

This is a Starter App for Inferno.js, an extremely fast, React-API compatible library.

It contains:

  • a complete infrastructure built on Inferno.js and Bootstrap
  • a web server based on Hapi
  • Babel.js and the needed presets and plugins. [see .babelrc]
  • build configs for Gulp.js and WebPack
  • testing skeleton based on Mocha & Chai
  • a minimal Redux state management
  • a rudimentary 'CarPool' WebApp showing a few (freely available) car pictures

inferno_front

Installation

npm install

Building

gulp

Gulp will then copy all the files from src/ to build/tmp and invoke WebPack which in turn will create a new release under build/release.

For continuous development use:

gulp watch

There's no hot-reloading because Inferno.js Components can't be consumed by WebPack's Hot-Loader. This is understandable as Inferno's components only have a React-compatible API but not the internal structure. For example, the InfernoDOM.render() function doesn't return the instance of the root Component. And without it the HotLoader will be unable to localize the root of the WebApp.

Example code from React Hot-Loading Docs

// When you render it, assign it to a variable
var rootInstance = React.render(RootComponent(), document.body);

// Then just copy and paste this part at the bottom of
// the file
if (module.hot) {
  require('react-hot-loader/Injection').RootInstanceProvider.injectProvider({
    getRootInstances: function () {
      // Help React Hot Loader figure out the root component instances on the page:
      return [rootInstance];
    }
  });
}

I'll try to find out if there's any possibility to hot-load Inferno's components and for the time being you can use the older livereload functionality provided by LiveReload Chrome-Plugin + gulp watch from the console.

Running

npm start

Hapi.js will use index.js from the root of the project and serve the contents on http://localhost:8080

Testing

npm test

inferno_test

or for continuous testing

npm test:watch

Currently, there's not much to test because everything here is still in flux.

License

MIT

About

:fire: Starter for Inferno.js, +WebPack, +Redux, +Mocha

License:MIT License


Languages

Language:JavaScript 98.1%Language:HTML 1.9%