-
-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code reloading #335
Comments
@veelenga since |
sentry by @samueleaton might be of help — it does restart the process, but it's something. |
Hello! I'm playing with Kemal, WebSockets and Sentry. Instead of ECR I'm using client side rendering (exist a lot of options EJS, Handlebears etc). EJS has similar syntax to ECR. This could be good only for fast development environment, when turn on production the views can be converted to plain HTML and then compiled to ECR (if is a static site). If is a dynamic one then client rendering is the way. Basically I'm using see: A example using EJS |
@veelenga Seems that Liquid.cr and Crustache are engines that support template render without recompile. However, Kilt doesn't support Liquid yet and the Crustache engine inside Kilt use |
https://github.com/samueleaton/sentry src/sentry.cr require "sentry"
sentry = Sentry::ProcessRunner.new(
process_name: "Kemal Dev",
build_command: "crystal build ./src/my_app.cr -o ./bin/my_app",
run_command: "./bin/my_app",
files: ["./src/**/*.cr", "./src/**/*.ecr"]
)
sentry.run after run dev by:
|
@huacnlee good 👍 I created a shard to use sentry embedded in my code without external require "kemal"
require "sentry-run"
get "/" do
"Hello world"
end
Sentry.config(files: ["src/app.cr"])
Sentry.run do
Kemal.run
end |
Sorry I was on hiatus for the last month or so. I'm thinking of adding the ability to add a hot-reloading client side build (for webpack or Gulp or whatever) in Sentry. Something similar to what webpack-dev-server or the phoenix framework (Elixir) do. But the trick is to keep sentry light and simple to use without too much feature bloat. If you think of anything you'd like to add in sentry or any shortcomings, feel free to create an issue. EDIT: I made a suggestion (as you can see below in the referenced issue) for a way we can add our own tooling into Kemal. This would allow us to inject things into the html to achieve features like webpack-dev-server for hot reloading. |
@faustinoaq How about integrated that into Kemal by using Compile-time flags? For example: module Kemal
# Overload of self.run with the default startup logging
def self.run(port = nil)
{% if flag?(:release) %}
kemal_run(port)
{% else %}
Sentry.run do
kemal_run(port)
end
{% end %}
end
def self.kemal_run(port = nil)
# original Kemal run implement
end
end |
@huacnlee sound great! In fact The fist version of |
If you have Node.js installed (not uncommon even for backend devs nowadays) you can simply run the instructions bellow (inside your project root directory, of course):
Where Now every time you make a change in any file inside your project, nodemon will automatically detect and re-build your project. Works like a charm with Kemal. |
Putting the following in your
|
Reading this issue I don't understand what is the recommended way to auto-reload the server-side part of the application as I edit the files? |
|
Using while sleep 0.25; do
tree -fiA --prune --noreport src | entr -rd crystal run src/app.cr
done |
awesome, this works, thanks |
Currently to see code changes we need to restart a web server. Are there plans/ideas regarding code reloading, so we would need just to reload a page, but do not restart a server ? Is it even possible to do for now ?
PS: thanks for a great work on Kemal!
The text was updated successfully, but these errors were encountered: