html-bundler-webpack-plugin

Alternative to html-webpack-plugin ✅ Renders Eta, EJS, Handlebars, Nunjucks, Pug, Twig templates "out of the box" ✅ Resolves source files of scripts, styles, images in HTML ✅ Uses a template as entry point

ISC License

Downloads
18.3K
Stars
140
Committers
7

Bot releases are hidden (Show)

html-bundler-webpack-plugin - v2.5.0

Published by webdiscus about 1 year ago

Cumulative Release v2.0.0 - v2.5.0

⚠ POTENTIAL BREAKING CHANGE (v2.0.0):

  • Upgraded the default preprocessor eta to next major version 3.0.
    Perhaps you may need to migrate your Eta templates to v3 syntax.

Features

  • Added the reference for data in the plugin options.
    The NEW syntactic "sugar":
    new HtmlBundlerPlugin({
      entry: {
        index: './src/views/home.ejs',
      },
      // new reference to the loaderOptions.data
      data: {...},
    }),
    
    The old syntax is still valid:
    new HtmlBundlerPlugin({
      entry: {
        index: './src/views/home.ejs',
      },
      loaderOptions: {
        // original option is under loaderOptions
        data: {...},
      },
    }),
    
  • Added the references for preprocessor and preprocessorOptions in the plugin options.
    The NEW syntactic "sugar":
    new HtmlBundlerPlugin({
      entry: {
        index: './src/views/home.ejs',
      },
      // new references to options in the loaderOptions
      preprocessor: 'ejs',
      preprocessorOptions: {...},
    }),
    
    The old syntax is still valid:
    new HtmlBundlerPlugin({
      entry: {
        index: './src/views/home.ejs',
      },
      loaderOptions: {
        // original options are under loaderOptions
        preprocessor: 'ejs',
        preprocessorOptions: {...},
      },
    }),
    
  • Added support for Webpack CSS optimization
  • Added support for TS
  • Added watching for create/rename/delete files in the entry path, without restarting Webpack
  • Improved performance when used the same style file in many templates
  • Added support for importing style files in JavaScript

Bug Fixes

  • Resolving the same resources used in imported styles on different pages
  • Correct importing styles in JS when used serve mode
  • Importing the raw content of the html file in js
  • Load the handlebars's partials with allowed extensions only, #24
  • Correct order of styles when the same style is imported in many nested JS files
  • Watching for create/rename/delete JS files
  • Watching for create/rename Handlebars partials
  • Add to watching only parent directories, ignore all subdirectories
  • Generate correct output filenames for assets in deep nested pages after changes in serve mode
  • Fixed in some cases is missing the hot-update.js file after changes in serve mode
  • Added missing slash in output filename when publicPath is an url without finishing slash
html-bundler-webpack-plugin - v1.18.0

Published by webdiscus about 1 year ago

Cumulative Release v1.0.0 - v1.18.0

Features

  • Added the js.chunkFilename option
  • Allow the data loader option as a filename for dynamically loading global template variables
  • Allow the data entry-point option as a filename for dynamically loading page template variables
  • New compact verbose output, all resources are grouped by their issuers
  • Removed js.verbose option, because it makes no sense with new verbose output (no breaking change)
  • Removed css.verbose option, because it makes no sense with new verbose output (no breaking change)
  • Added the views option for the nunjucks preprocessor
  • Allow to pass the configuration options for the nunjucks preprocessor
  • Automatically add to watching directories defined in the preprocessor options root views partials
  • Added root loader option to allow use the / as root path to source directory for asset files
  • Added preload option to auto generate preload tags for resources such as font, image, video, audio, script, style, etc.
  • Allow resolving all duplicate scripts and styles in the template so that they can be preloaded with a link tag
  • Removed warnings for duplicate script and styles in the template
  • Added preload option to auto generate preload tags for resources such as font, image, video, audio, script, style, etc.
  • Allow resolving all duplicate scripts and styles in the template so that they can be preloaded with a link tag
  • Removed warnings for duplicate script and styles in the template
  • Added minifyOptions to customize minification when the minify options is auto, FR #5
  • Added helpers value as array of a relative or absolute path to helper directories for the handlebars preprocessor
  • Added the entry option value as a relative or absolute path to pages
  • Added the data loader option to pass global data into all templates
  • Added default template extensions: .njk
  • Added preprocessor value as string nunjucks to use the preconfigured Nunjucks compiler (nunjucks package needs to be installed)
  • Added preprocessorOptions to the loader option to define a custom config for the default preprocessor
  • Added resolving a template partial relative to template
  • Added default template extensions: .hbs and .handlebars
  • Added preprocessor value as string ejs to use the preconfigured EJS compiler (ejs package needs to be installed)
  • Added preprocessor value as string handlebars to use the preconfigured Handlebars compiler (handlebars package needs to be installed)
  • Added asset/source support for SVG to inline it in HTML
  • Added hot update file to HTML in serv mode when there is no script in template, to reload page after changes
  • Added css.inline option, replaces the functionality of style-loader
  • Added js.inline option to inline extracted JS into HTML
  • Added to the ?inline query parameter for JS and CSS files the values: false, true, 'auto'
  • Added the loaderOptions to the plugin option to allow defining loader options with the plugin
  • Display watch files in watch/serv mode when verbose option is enabled
  • Added auto value for the verbose option
  • Added watchFiles option to configure paths and files to watch file changes
  • Set the config option root of the Eta preprocessor as current working dir by defaults
  • Added support for both async and sync preprocessor, the preprocessor should return a string or a promise
  • Added resolving of href attribute in the SVG <image> and <use> tags, by defaults

Bug fixes

  • Do not delete split chunks from compilation loading dynamically
  • Allow to define the as property of the preload option in the attributes
  • Correct parsing of a query where the key does not contain a value, e.g. ?enable&size=100
  • Live reload after changes if a template contains a commented out script
  • Fixed issue if a CSS file is imported in SCSS with a filename, including the .css extension, e.g. @import 'npm-module/styles.css'
  • Fixed issue if used the copy plugin which copies an HTML file
  • Fixed pass data via query parameters into template imported in JS file
  • Inject hot update js file after changes when the template has no scripts
  • Display loader dependencies only once in the watch mode
  • Correct inline CSS and JS when is used minify, #8
  • Set the default removeRedundantAttributes: false minify option to prevent styling bug when input "type=text" is removed
  • Allow the partials values to be relative paths for the handlebars preprocessor
  • Display an original error stack by nested exceptions
  • Handle unsupported value of the preprocessor option
  • Fixed inline a style from the link tag with the attribute as="style"
  • Keep output filename extension, different from .html, e.g. [name].php, #4
  • Fixed yarn when can't correctly install packages form standard npm peerDependencies.
  • Added the enhanced-resolve to peerDependencies
  • Correct rebuild the node modules specified in a template or imported in a script, after changes in the template of in the script
  • Added missing node modules to compilation after rebuild
  • Resolve resources in the entry file containing a query
  • Correct inline JS when used split chunks
  • Emit a loader exception as an instance of Error instead a string
  • Throw exception when the loader is used but the HtmlBundlerPlugin is not initialized in Webpack plugins option
  • Correct loader export when template contain CRLF line separators
  • Correct resolve auto value for verbose option
  • After an error, restore watching without restarting
  • Resolve correct output asset path when the publicPath is a URL
  • Resolving of assets under Windows
  • Handling an issue when used an async preprocessor
  • Add only unique optional sources attribute
html-bundler-webpack-plugin - First Release

Published by webdiscus about 1 year ago

Features

  • Handle HTML files from webpack entry
  • Inline binary images, e.g. PNG
  • Inline SVG images
  • Added supports for the inline CSS in HTML
  • Added supports for the inline JS in HTML
  • Added support for <input> <audio> <video> <track> tags
  • Added test plugin option to process entry files that pass test assertion
  • Added entry plugin option, this option is identical to Webpack entry plus additional data property
  • Added js plugin option to extract JavaScript files from source scripts loaded in HTML via a <script> tag and generates a separate file for it
  • Added css plugin option to extract CSS files from source styles loaded in HTML via a <link> tag and generates a separate file for it
  • Added preprocessor loader option to allow pre-processing of content before handling
  • Added postprocess plugin option
  • Added sources loader option to define custom tags and attributes for resolving source files
  • Added extractComments plugin option to enable/disable saving comments in *.LICENSE.txt file
  • Added to default resolving the data attribute of object tag
  • Added supports the responsive-loader
  • Added the default template loader in Webpack module.rule
  • Resolve the Webpack alias in the source file name
  • Process the images, fonts from sources loaded via <link>, <img> or <source> tags and generates a separate file for it
  • Resolve and extracts images from sources loaded via url() in a style (css, scss)
  • Resolve auto publicPath