Giter Site home page Giter Site logo

fivelucky / inject-body-webpack-plugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jaid/inject-body-webpack-plugin

0.0 1.0 0.0 2.82 MB

Webpack plugin that injects a custom string into the body of the html-webpack-plugin output.

Home Page: https://github.com/Jaid/inject-body-webpack-plugin

License: MIT License

JavaScript 100.00%

inject-body-webpack-plugin's Introduction

inject-body-webpack-plugin

License Sponsor inject-body-webpack-plugin
Build status Commits since v1.3.0 Last commit Issues
Latest version on npm Dependents Downloads

Webpack plugin that injects a custom string into the body of the html-webpack-plugin output.

Installation

inject-body-webpack-plugin on npm

npm install --save-dev inject-body-webpack-plugin@^1.3.0

inject-body-webpack-plugin on Yarn

yarn add --dev inject-body-webpack-plugin@^1.3.0

Example

Input

webpack.config.babel.js

import HtmlWebpackPlugin from "html-webpack-plugin"
import InjectBodyPlugin from "inject-body-webpack-plugin"

export default {
  plugins: [
    new HtmlWebpackPlugin({
      templateContent: "<html><body></body></html>"
    }),
    new InjectBodyPlugin({
      content: '<main id=root>Hi!</main>'
    }),
  ],
}

Output

index.html

<html><body><main id=root>Hi!</main></body></html>

Options

Type Default Info
content string <div id=root/> The text that will be injected into the final HTML output.
position string start If “start”, the content will be injected as close to the body opening tag as possible. If “end”, the content will be injected as close to the body ending tag as possible.

Development

Development hints for maintaining and improving inject-body-webpack-plugin

Setting up:

git clone [email protected]:jaid/inject-body-webpack-plugin.git
cd inject-body-webpack-plugin
npm install

Testing in production environment:

npm run test

License

MIT License
Copyright © 2021, Jaid <[email protected]> (https://github.com/jaid)

inject-body-webpack-plugin's People

Contributors

actions-user avatar github-actions[bot] avatar jaid 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.