Skip to content
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

Feature request : Hot Reload / Live Reload #354

Closed
0fflineuser opened this issue May 26, 2024 · 5 comments
Closed

Feature request : Hot Reload / Live Reload #354

0fflineuser opened this issue May 26, 2024 · 5 comments

Comments

@0fflineuser
Copy link

Hi,

I think they would be great for when developping, as it would eliminate the need to manually refresh the web page and allowing us to instantly see changes in the browser.

Examples :

@rabbibotton
Copy link
Owner

rabbibotton commented May 26, 2024 via email

@rabbibotton
Copy link
Owner

rabbibotton commented May 26, 2024 via email

@0fflineuser
Copy link
Author

Thanks a lot !
I am new to common lisp and clog. I see that reload is in the manual and used in the tutorial 14, sry I missed it.

So for the live reload I did the following :

(defun dev-live-reload ()
  (progn
   (if (not (boundp '*CURRENT-WINDOW*))
       (defparameter *CURRENT-WINDOW* nil))
   (if (and *CURRENT-WINDOW* (equal (type-of *CURRENT-WINDOW*) 'clog-location))
       (reload *CURRENT-WINDOW*))))
       
(defun on-index (body)
  (setf *CURRENT-WINDOW* (location body))
  ;; .... 
)

(defun start-app ()
  (initialize 'on-index)
  (open-browser))

;; reload the page
(dev-live-reload)

Now I just do my changes, reload the file and the browser also reload itself !

@rabbibotton
Copy link
Owner

rabbibotton commented May 26, 2024 via email

@aykaramba
Copy link
Contributor

aykaramba commented May 26, 2024

Also, if you use Emacs or lem, you can just bind a key binding to call something like:

  (defun reload (obj)
    (url-replace (location body) "/"))

Here is my Lem binding: https://github.com/aykaramba/edgar/blob/main/commands.lisp

I load that up in my EDGAR project, it is Lem specific. I need to write one for Emacs as well.

When I am coding in C-c all the time and when I want to see my changes updated in the browser I just C-v whenever I want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants