Giter Club home page Giter Club logo

magenta-hot-reload's Introduction

magenta-hot-reload

Dead-HMR

  • Install: make install-dead-hmr

  • Run: make run-dead-hmr

  • Description:

It is a simple DIY HMR, and is based on none of these frameworks: React/Vue/Angular. It can only detects changes of *.html, *.css and *.js files.

  • How it works
  • Start the app, and listen to port 3001.

  • Create websocket connection, and listen to port 8000.

  • Watch file changes, read file content and send messages to websocket client.

  • Websocket client handle messages from websocket server.

If it is of type html, re-write the file.

If it is of type css, remove previous tag, and add new tag.

If it is of type js, use eval() to execute script.

( To be noticed, if we don't remove previous listeners before excuting script, listeners will be pushed to the element listener array. To fix this, we have to remove all of the previous listeners. The easy way is to clone old node, and replace it with a new one.)

  • Serious bug of Dead-HMR: No Diff. I just simply replace the whole old one the new one.

Easy-Hot-Client

It is a mini version of webpack-hot-client.

First, let's see how to use webpack-hot-client in your real app.

// install
make install-webpack-hot-client-demo
// run
make run-webpack-hot-client-demo

magenta-hot-reload's People

Contributors

magentaqin avatar

Watchers

 avatar

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.