1.0.1 • Published 2 years ago

@webpackon/use-html v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@webpackon/use-html

Features:

  • adds html template support (uses html-webpack-config).
  • minification html for production

Install

npm i @webpackon/use-html --save
yarn add @webpackon/use-html

API

const { useHtml } = require('@webpackon/use-html');

useHtml(params: UseHtmlParams)(config: WebpackConfig)

UseHtmlParams

export type UseHtmlParams = {
  mode: 'development' | 'production';
  title?: string;
  templatePath?: string;
};
  • mode - webpack mode

  • title - html title

  • templatePath - path for html template

Example

Full examples are here

const path = require('path');

const { compose } = require('@webpackon/core');
const { useHtml } = require('@webpackon/use-html');

module.exports = (_, { mode }) =>
  compose(
    useHtml({
      mode,
      templatePath: path.resolve(__dirname, 'public', 'index.html'),
    }),
  )({
    target: 'web',
    entry: path.resolve(__dirname, 'src', 'index.tsx'),
  });