Skip to content

Abdallah-Abdelrahman/HMR

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HMR (Hot Module Replacement)

HMR is a lightweight tool that updates your browser in real-time without requiring a page refresh.


Motivation

When working on projects that do not use UI libraries like React or Vue—which come with built-in Hot Module Replacement—developers often miss out on the benefits of live updates. While tools like browser-sync offer similar functionality, they can be resource-intensive and heavy on system memory. HMR was created as a lean alternative to speed up development by instantly reflecting UI changes without the overhead.

Installation

  1. Clone the repository:
    git clone https://github.com/Abdallah-Abdelrahman/HMR.git
  2. Navigate to the project directory:
    cd HMR
  3. Install dependencies:
    go mod tidy

Usage

  1. Build the static binary:
    make build-static
  2. Create a symlink to the binary:
    sudo ln -s <project-absolute-path>/bin/hmr /usr/local/bin/hmr
  3. Run HMR from anywhere:
    hmr <path-to-directory-containing-html|css|js-files>
  4. Embed the client-side script:
    Include this script in your HTML file to enable live updates.

About

go CLI to watch for changes in static files and update browser without refreshing the page

Topics

Resources

License

Stars

Watchers

Forks

Contributors