Closed kristianmandrup closed 9 years ago
So the issue with swapping out roots' server is that charge includes websocket functionality that is used for the page refresh. And its API for handling the websocket piece would not work with any other random server, unless it purposefully exactly mimicked charge. This means errors would be thrown left and right in watch mode as nonexistant functions were called.
I assume that whatever server you are trying to replace charge with does not ship with websocket functionality for the purpose of using livereload, and even if it does it probably does not exactly match charge's API. If this is indeed the case, you must give up live reload through roots during development. If this is ok with you, you can simply run your server and set it to use /your_roots_project/public
as its static root, and manually reload after changes have been compiled. Charge will still run in the background, but takes minimal CPU and you simply can ignore it. If you don't want the page to open automatically on watch, just include server: { no_open: true }
in your app.coffee
and nothing will open in the browser on watch, you can open it yourself to whatever port your custom server is running on.
Hope this helps!
Thanks for the info. Makes perfect sense. My setup includes browser sync, so works just fine with live reload. Pretty standard these days... On top of that, I will use Roots.cx to generate Marko templates on the fly, so I need to teach Jade to understand specific Marko and Lasso templates via Pencil :o All good :) super powerful combo!!!
I need to use an existing Koa server configured with a bunch of extra features. How do I swap out charge server in roots config?
server.js
seems to useconnect
serverEasy to swap out for sure :) But could be made even easier...
I see the following in
commands/serve.js
, that I could also swap out:Same for
watch
command: