Coder Social home page Coder Social logo

kdepp / html-webpack-inline-source-plugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dustinjackson/html-webpack-inline-source-plugin

0.0 2.0 0.0 21 KB

Embed javascript and css source inline when using the webpack dev server or middleware

License: MIT License

JavaScript 100.00%

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

Inline Source extension for the HTML Webpack Plugin

npm version Build status js-semistandard-style

Enhances html-webpack-plugin functionality by adding the {inlineSource: 'regex string'} option.

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 4 or higher

Install the plugin with npm:

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

Basic Usage

Require the plugin in your webpack config:

var HtmlWebpackInlineSourcePlugin = require('html-webpack-inline-source-plugin');

Add the plugin to your webpack config as follows:

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

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

When you set inlineSource to a regular expression the source code for any javascript or css file names that match will be embedded inline in the resulting html document.

plugins: [
  new HtmlWebpackPlugin({
		inlineSource: '.(js|css)$' // embed all javascript and css inline
	}),
  new HtmlWebpackInlineSourcePlugin()
]  

Sourcemaps

If any source files contain a sourceMappingURL directive that isn't a data URI, then the sourcemap URL is corrected to be relative to the domain root (unless it already is) instead of to the original source file.

All sourcemap comment styles are supported:

  • //# ...
  • //@ ...
  • /*# ...*/
  • /*@ ...*/

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

Contributors

andybarron avatar callumacrae avatar dustinjackson avatar ggd543 avatar kdepp avatar pluma avatar

Watchers

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