Giter Club home page Giter Club logo

html-webpack-inline-chunks-plugin's Introduction

html-webpackinline-chunks-plugin

a webpack plugin work with html-webpack-plugin,use it to insert script as inline to html file. This is an extension plugin for the webpack plugin html-webpack-plugin. It allows you to embed javascript and css source inline.

Installation

You must be running webpack on node 0.12.x or higher

Install the plugin with npm:

$ npm install --save-dev html-webpack-inline-chunks-plugin

Basic Usage

Require the plugin in your webpack config:

var HtmlWebpackInlineChunksPlugin = require('html-webpack-inline-chunks-plugin');

Add the plugin to your webpack config as follows:

plugins: [
  new HtmlWebpackPlugin(),
  new HtmlWebpackInlineChunksPlugin()
]  

The above configuration will actually do nothing due to the configuration defaults.

When you set inlineChunks to chunks array will be embedded inline in the resulting html document.

entry: {
  loading: './xxx/loading'
},
plugins: [
  new HtmlWebpackPlugin({
		inlineChunks: ['loading']
	}),
  new HtmlWebpackInlineChunksPlugin()
]  

if you have many pages and want to set the same chunk, do like this

entry: {
  layer: './xxx/layer'
  loading: './xxx/loading'
},
plugins: [
  new HtmlWebpackPlugin({
		inlineChunks: []
	}),
  new HtmlWebpackPlugin({
		inlineChunks: ['layer']
	}),
  new HtmlWebpackInlineChunksPlugin({
    chunks: ['loading']
  })
]  

html-webpack-inline-chunks-plugin's People

Contributors

rookiewan avatar

Watchers

 avatar  avatar

html-webpack-inline-chunks-plugin's Issues

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.