dbashford / mimosa-server-template-compile

A mimosa module for compiling server templates as part of a build
3 stars 1 forks source link

Mimosa embedded server stops serving index #5

Closed xixixao closed 10 years ago

xixixao commented 10 years ago

When using this module, mimosa doesn't compile the jade into html on watch, only on build. After using build though, index.html is served by the Mimosa embedded server and hence LiveReload breaks.

mimosa build
make
# changes to jade files won't be reflected

Maybe the easiest fix would be to compile the html on watch? If that's not desirable (speed, some jade functionality), what would be the easiest way to compile these files into a separate folder (I am thinking dist with index.html and rest of assets and build without the html) during watch?

dbashford commented 10 years ago

The thinking around only doing the compile on build is that when you are just watching you are able to serve them templates dynamically via mimosa-server. Transforming them to .html files is only needed when leaving Mimosa behind and taking code someplace where dynamic views can't be used.

So what is the use case to not being using the dynamic templates during watch?

xixixao commented 10 years ago

I want to use the dynamic templates during watch. The problem is that taking the website and putting it on a server, let's say, breaks the build directory.

My use case is rather dumb, because I needed to test on mobile device, so I was just periodically pushing the static version out to a server, instead of just connecting to my localhost. I guess the main problem is that you can't easily build into a different directory (or can you?). Otherwise you have to:

You might not be doing this often, but it still annoying (and quite a hidden bug, because all you see is that the index is not updating).

dbashford commented 10 years ago

You could use build profiles to redirect builds.

So mimosa build -omp -P mobile and inside profiles/mobile.coffee you'd have something like...

watch:
  compiledDir:'../someplace/else`

Is that what you are talking about?

xixixao commented 10 years ago

Ah, profiles, perfect. Thanks for your patience!