Git Product home page Git Product logo

aframe-super-hot-loader's Introduction

aframe-super-hot-loader

Webpack loaders for enabling Hot Module Replacement on A-Frame HTML, components, and shaders.

Live reload A-Frame, components, and shaders. Never refresh the page during development again!

Watch Video

Usage

Installation

npm install --save aframe-super-hot-loader
npm install --save aframe-super-hot-html-loader diff-dom

Webpack Config

There are two separate Webpack loaders, one for JS and one for HTML. In your Webpack config:

module.exports = {
  // ...
  module: {
    rules: [
      {
        test: /\.js/,
        exclude: /(node_modules)/,
        use: ['aframe-super-hot-loader']
      },
      {
        test: /\.html/,
        exclude: /(node_modules)/,
        use: ['aframe-super-hot-html-loader']
      }
    ]
  }
  // ...
}

Dev Server

Then run webpack-dev-server with hot enabled:

webpack-dev-server --hot --inline

or in your Webpack config:

module.exports = {
  devServer: {
    hot: true
  }
};

Requiring

For the HTML loader, you'll need to require an HTML file through Webpack that contains your scene, which will be injected into your index.html.

// index.js
require('./scene.html');

And an example HTML file:

<!-- index.html -->
<html>
  <head>
    <script src="build/build.js"></script>
  </head>
  <body>
    <!-- require('./scene.html') will be injected here from the JS build. -->
  </body>
</html>

Boilerplate Example

There's a boilerplate example in the examples/ directory:

cd examples
npm install
npm run start

Then try it out by modifying files. If you'd like to incorporate into your own project, you can start from that boilerplate base and / or absorb the Webpack configuration.

aframe-super-hot-loader's People

Contributors

ngokevin 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.