Demonstration of webpack and mithril
After reading http://lhorie.github.io/mithril-blog/integrating-mithril-and-requirejs.html I wanted to look more into mithril so don't take the demo as the ideal way to work or to achieve these goals merely how I got it to work.
My goals were:
- Use pathname module routing
- Single page application
- Nodejs module dependencies
- Bundle pages into distinct downloads to reduce initial page load
I did manage to do all 4 items. A bit more setup than I was hoping for.
- can use any server rewriting, I am using nginx so you need it on your path for it to work.
- worked mostly as expected. I had issues getting the basic a href to work here, not sure why.
- webpack provides this without any problems so far.
- This was rather easy once I figured out "bundling" was the term I was looking for.
- Clone the repository
git clone https://github.com/blanchg/mithril-webpack
- Install with npm
npm install
- Buid using
webpack
- Ensure nginx is installed and available via the path http://nginx.org
- Start using npm
npm start
- When you are finished stop with
npm stop