How to use mini-html-webpack-plugin - 10 common examples

To help you get started, we’ve selected a few mini-html-webpack-plugin examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vue-styleguidist / vue-styleguidist / packages / vue-styleguidist / src / scripts / make-webpack-config.ts View on Github external
webpackConfig = merge(webpackConfig, {
		// we need to follow our own entry point
		entry: config.require.concat([path.resolve(sourceDir, 'index')]),
		resolve: {
			alias: {
				// allows to use the compiler
				// without this, cli will overload the alias and use runtime esm
				vue$: require.resolve('vue/dist/vue.esm.js')
			}
		},
		plugins: [
			// in order to avoid collision with the preload plugins
			// that are loaded by the vue cli
			// we have to load these plugins last
			new StyleguidistOptionsPlugin(config),
			new MiniHtmlWebpackPlugin(htmlPluginOptions),
			new webpack.DefinePlugin({
				'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
				'process.env.STYLEGUIDIST_ENV': JSON.stringify(env)
			})
		]
	})

	// To have the hot-reload work on vue-styleguide
	// the HMR has to be loaded after the html plugin.
	// Hence this piece added last to the list of plugins.
	if (isProd) {
		const optimization = config.minimize
			? {
					minimizer: [
						new TerserPlugin({
							parallel: true,
github styleguidist / react-styleguidist / src / scripts / make-webpack-config.ts View on Github external
let webpackConfig: Configuration = {
		entry: config.require.concat([path.resolve(sourceDir, 'index')]),
		mode: env,
		output: {
			path: config.styleguideDir,
			filename: 'build/[name].bundle.js',
			chunkFilename: 'build/[name].js',
			publicPath: '',
		},
		resolve: {
			extensions: ['.wasm', '.mjs', '.js', '.jsx', '.ts', '.tsx', '.json'],
			alias: {},
		},
		plugins: [
			new StyleguidistOptionsPlugin(config),
			new MiniHtmlWebpackPlugin(htmlPluginOptions),
			new webpack.DefinePlugin({
				'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
				'process.env.STYLEGUIDIST_ENV': JSON.stringify(env),
			}),
		],
		performance: {
			hints: false,
		},
	};

	if (isProd) {
		const minimizer = new TerserPlugin({
			/* eslint-disable @typescript-eslint/camelcase */
			terserOptions: {
				ie8: false,
				ecma: 5,
github neo-one-suite / neo-one / scripts / website / webpack / testRunner.ts View on Github external
<title>${title}</title>
              ${MiniHtmlWebpackPlugin.generateCSSReferences({ files: css, publicPath })}
              <style>
                body {
                  margin: 0;
                  background-color: #F8F5FD;
                  text-rendering: optimizeLegibility;
                }
              </style>
            
            
              <div id="app"></div>
              ${MiniHtmlWebpackPlugin.generateJSReferences({ files: js, publicPath })}
            
          `,
    }),
github neo-one-suite / neo-one / scripts / website / webpack / testRunner.ts View on Github external
template: ({ css, js, title, publicPath }: any) =&gt;
        `
          
            
              
              <title>${title}</title>
              ${MiniHtmlWebpackPlugin.generateCSSReferences({ files: css, publicPath })}
              <style>
                body {
                  margin: 0;
                  background-color: #F8F5FD;
                  text-rendering: optimizeLegibility;
                }
              </style>
            
            
              <div id="app"></div>
              ${MiniHtmlWebpackPlugin.generateJSReferences({ files: js, publicPath })}
            
          `,
    }),
github jxnblk / mdx-docs / lib / template.js View on Github external
return context => {
    const scripts = HTMLPlugin.generateJSReferences(context.js, context.publicPath)
    return minify(
      template(Object.assign({}, context, { scripts })),
      {
        collapseWhitespace: true
      }
    )
  }
}
github reakit / reakit / packages / website / src / template.js View on Github external
${generateCSSReferences(css, publicPath)}
      
      
      
    
    
      <div id="rsg-root"></div>
      ${generateJSReferences(js, publicPath)}
    
  `;
github SpareBank1 / designsystem / styleguide.config.js View on Github external
const template = fs.readFileSync(
            path.join(__dirname, 'src', 'styleguidist.html'),
            'utf-8',
        );
        return template
            .replace(
                '',
                `<title>${title}</title>`,
            )
            .replace(
                '',
                MiniHtmlWebpackPlugin.generateCSSReferences(css, publicPath),
            )
            .replace(
                '',
                MiniHtmlWebpackPlugin.generateJSReferences(js, publicPath),
            );
    },
    sections: [
github jxnblk / ok-mdx / packages / ok-cli / lib / index.js View on Github external
const template = ({
  title = 'ok',
  js,
  publicPath
}) =&gt; `




<style>*{box-sizing:border-box}body{font-family:system-ui,sans-serif;margin:0}</style>
<title>${title}</title>


<div id="root"></div>
${HTMLPlugin.generateJSReferences(js, publicPath)}


`
github neo-one-suite / neo-one / packages / neo-one-simulation-react-template / template / scripts / start.ts View on Github external
<title>${title}</title>
              ${MiniHtmlWebpackPlugin.generateCSSReferences(css, publicPath)}
              <style>
              body {
                margin: 0;
                text-rendering: optimizeLegibility;
              }
              </style>
            
            
              <div id="app"></div>
              ${MiniHtmlWebpackPlugin.generateJSReferences(js, publicPath)}
            
          `,
    }),
github jxnblk / ok-mdx / lib / template.js View on Github external
css = '',
  js,
  publicPath,
}) =&gt; `





<title>ok-mdx</title>
<style>*{box-sizing:border-box}body{margin:0;font-family:system-ui,sans-serif}</style>
${css}


<div id="root">${html}</div>
${generateJSReferences(js, publicPath)}


`

mini-html-webpack-plugin

A miniature version of html-webpack-plugin with only necessary features

MIT
Latest version published 4 years ago

Package Health Score

57 / 100
Full package analysis