1.1.0 • Published 3 years ago

inline-raw-source-plugin v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago
  npm i --save-dev inline-raw-source-plugin
  yarn add --dev inline-raw-source-plugin

The plugin will generate a file that you set the entries in your webpack config. The current state just allows to generate html or cshtml file with using script tags. Just add the plugin to your webpack config as follows:

webpack.config.js

const InlineRawSourcePlugin = require('inline-raw-source-plugin')
module.exports = {
  entry: {
      main: 'index.js',
      inlineScript: 'inlineScript.js'
  },
  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: '[name].js'
  },
  plugins: [
    new InlineRawSourcePlugin({
        chunkname: ["inlineScript"]
    })
  ]
}

This will generate a file dist/inline-source.html(default) containing the following

<script>{{your code}}</script>

⚠️ The file you want to generate is only allowed to write as ES5(without babel).

Allowed values are as follows:

NameTypeDefaultDescription
chunkname{Array.<string>}[]You have to specify the values as same as your entries when you need the entry chunk to generate a html file.
filename{String}'inline-source.html'The final file name for the generated HTML document
path{string}nullIf you set this option, you can change the output path that you set in webpack output config.

Here's an example webpack config illustrating how to use these options

webpack.config.js

{
  entry: {
      main: 'index.js',
      inlineScript: 'inlineScript.js'
  },
  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: '[name].js'
  },
  plugins: [
    new InlineRawSourcePlugin({
        chunkname: ["inlineScript"],
        filename: "output.html",
        path: path.resolve(__dirname, 'otherFolder'),
    })
  ]
}
1.0.2

3 years ago

1.1.0

3 years ago

1.0.1

3 years ago

1.0.3

3 years ago

1.0.0

3 years ago

1.0.0-beta.5

3 years ago

1.0.0-beta.4

3 years ago

1.0.0-beta.3

3 years ago

1.0.0-beta.2

3 years ago

1.0.0-beta.1

3 years ago