alexmingoia / pux-starter-app

Starter Pux app w/ hot-reloading and isomorphic routing and rendering
https://www.purescript-pux.org
BSD 3-Clause "New" or "Revised" License
101 stars 39 forks source link

Question: Minimizing toolset #4

Closed sectore closed 8 years ago

sectore commented 8 years ago

First of all: Pux is just awesome - thanks for this great stuff!

What about minimizing the toolset (Pulp, Gulp) to build the app? The implementation of Hot Module Replacement (HMR) could be simplified, too. Here is an example based on your Pux Counter, but it is build with webpack only (without the need of Pulp and / or Gulp) https://github.com/sectore/purescript-webpack-vanilla-hmr

alexmingoia commented 8 years ago

Wow! That example is great. I agree about removing pulp and gulp. It'd be great if that were a PR, otherwise I could link to that repo instead of this one in the guide and readme.

sectore commented 8 years ago

Nice, I would love to do a PR ;) What is the reason about the server side rendering (https://github.com/alexmingoia/pux-starter-app/blob/master/src/js/index.js#L9 and https://github.com/alexmingoia/pux-starter-app/blob/master/src/purs/Main.purs#L36)?

alexmingoia commented 8 years ago
module.exports = function (url) {
    return Main.server(url)(initialState)();
};

The reason for this is because the app needs the request URL to do any routing with Pux.Router, and so if src/js/index.js is required in nodejs, it will export a function that takes the request URL from something like Express. There may be a better way to accomplish this.

The other thing I now notice is that when I rewrote this for Pux 1.0.0, I did not actually add back in the code for server-side rendering... so this code isn't even being called. :laughing:

alexmingoia commented 8 years ago

I don't think the server-side rendering is necessary as part of the starter-app. It can always be added later.