An open API service indexing awesome lists of open source software.

https://github.com/h-ikeda/html-webpack-display-loader-plugin

Inject light weight html & css to display a loader until script is loaded via HTML Webpack Plugin.
https://github.com/h-ikeda/html-webpack-display-loader-plugin

Last synced: 10 months ago
JSON representation

Inject light weight html & css to display a loader until script is loaded via HTML Webpack Plugin.

Awesome Lists containing this project

README

          

# html-webpack-display-loader-plugin
Inject light weight html & css to display a loader until your script is loaded via HTML Webpack Plugin.
## Usage
▼Input
```
const HtmlWebpackPlugin = require("html-webpack-plugin");
const HtmlWebpackDisplayLoaderPlugin = require("html-webpack-display-loader-plugin");

module.exports = {
// ...
plugins: [
new HtmlWebpackPlugin(),
new HtmlWebpackDisplayLoaderPlugin({
id: "root-element-id",
class: "root-element-class"
})
]
};
```
▼Output
```



Webpack App

/* Loader's styles here. Default loader display a simple blinking text.*/







```

You can replace the root div tag when the bundled script loaded. For Ex., in index.js
```
addEventListener("DOMContentLoaded", function() {
var app = document.createElement("div");
document.body.replaceChild(app, document.body.firstElementChild);
});
```

Many frameworks like vuejs, react, mithril are automatically replace the elements by query.
Ex. Vuejs
```
new Vue({
el: "#app",
render: h => h(vueComponent)
});
```
will replace the element which have "app" id to the Vue component.