Git Product home page Git Product logo

live-sh's Introduction

Live shell

 __    ____  _  _  ____    ___  _   _
(  )  (_  _)( \/ )( ___)  / __)( )_( )
 )(__  _)(_  \  /  )__)   \__ \ ) _ (
(____)(____)  \/  (____)()(___/(_) (_)

Live reloading with Bash for any language and any framework

Get started

Copy live.sh into your project directory

curl -o live.sh https://raw.githubusercontent.com/roman-koshchei/live-sh/main/live.sh

Change instructions inside of run function. Notice long running process should be run in background and saved to previous_pid. Here is example to run Gleam project, where gleam run is long running process:

run() {
  gleam run &
  previous_pid=$!
  gleam format &
}

Run script with ./live.sh. If you are on Windows then use Git Bash or WSL.

Browser reloading

If you are building web app you may want to automatically reload browser tab after live reloading project. For it you need to add javascript script to your site, don't forget to disable it in production.

Just embed live.js into your head like this:

<head>
  <script>
    document.addEventListener("visibilitychange", function () {
      "visible" === document.visibilityState &&
        setTimeout(function () {
          location.assign(location.href)
        }, 250)
    })
  </script>
</head>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.