New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

html-bundler-webpack-plugin

Package Overview
Dependencies
Maintainers
0
Versions
192
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-bundler-webpack-plugin - npm Package Versions

1
20

1.15.0

Diff

Changelog

Source

1.15.0 (2023-04-05)

  • feat: add the views option for the nunjucks preprocessor
  • feat: allow to pass the configuration options for the nunjucks preprocessor
  • feat: automatically add to watching directories defined in the preprocessor options root views partials
    for example, several template directories are not subdirectories, but are on the same level:
    preprocessorOptions: {
      root: 'pages/',
      views: ['templates/layouts/', 'templates/includes/'],
      partials: ['templates/partials/'],
    }
    
webdiscus
published 1.14.0 •

Changelog

Source

1.14.0 (2023-04-04)

  • feat: add root loader option to allow use the / as root path to source directory for asset files:
    new HtmlBundlerPlugin({
      loaderOptions: {
        root: path.join(__dirname, 'src'),
      },
    }),
    
    to resolve the /src/images/apple.png source file, use the root path /:
    <img src="/images/apple.png" />
    
  • refactor: optimize code
  • test: add tests for new features
  • docs: add description of new features
webdiscus
published 1.13.0 •

Changelog

Source

1.13.0 (2023-04-03)

  • feat: add preload option to auto generate preload tags for resources such as font, image, video, audio, script, style, etc.
  • feat: allow resolving all duplicate scripts and styles in the template so that they can be preloaded with a link tag
  • feat: remove warnings for duplicate script and styles in the template
  • fix: set the default removeRedundantAttributes: false minify option to prevent styling bug when input "type=text" is removed
  • chore: update dev dependencies
  • test: add tests for new features
  • docs: add description of new features
webdiscus
published 1.12.0 •

Changelog

Source

1.12.0 (2023-03-29)

  • feat: add minifyOptions to customize minification when the minify options is auto, FR #5
  • feat: add helpers value as array of a relative or absolute path to helper directories for the handlebars preprocessor
  • fix: allow the partials values to be relative paths for the handlebars preprocessor
  • test: add tests for new features
  • docs: add description of new features
webdiscus
published 1.11.0 •

Changelog

Source

1.11.0 (2023-03-27)

  • feat: add the entry option value as a relative or absolute path to pages.
    Template files matching the test option are read recursively from the path.
    For example, there are files in the ./src/views/pages/
    ./src/views/pages/index.html
    ./src/views/pages/about/index.html
    ./src/views/pages/news/sport/index.html
    ./src/views/pages/news/sport/script.js
    ./src/views/pages/news/sport/style.scss
    ...
    
    Define the entry option as the relative path to pages:
    new HtmlBundlerPlugin({
      entry: 'src/views/pages/',
    });
    
    Internally, the entry is created with the templates matching to the test option:
    {
      index: 'src/views/pages/index.html', // => dist/index.html
      'about/index': 'src/views/pages/about/index.html', // => dist/about/index.html
      'news/sport/index': 'src/views/pages/news/sport/index.html', // => dist/news/sport/index.html
    }
    
    The output HTML filenames keep their source structure relative to the entry path.
  • fix: display an original error stack by nested exceptions
webdiscus
published 1.10.0 •

Changelog

Source

1.10.0 (2023-03-26)

  • feat: add the data loader option to pass global data into all templates
    Note: use the data property of the entry option to pass data only in one template
    new HtmlBundlerPlugin({
      entry: {
        index: {
          import: './src/home.html',
          data: {
            title: 'Home', // overrides the `title` defined in the loader data
          },
        },
        about: './src/about.html',
      },
      loaderOptions: {
        data: {
          // <= NEW option to pass global variables for all pages
          title: 'Default Title',
          globalData: 'Global Data',
        },
      },
    });
    
  • feat: add default template extensions: .njk.
    The following default template extensions are now supported: /\.(html|ejs|eta|hbs|handlebars|njk)$/
  • feat: add preprocessor value as string nunjucks to use the preconfigured Nunjucks compiler (nunjucks package needs to be installed)
    new HtmlBundlerPlugin({
      entry: {
        index: './src/views/pages/home.njk',
      },
      loaderOptions: {
        preprocessor: 'nunjucks', // <= NEW 'nunjucks' value
        preprocessorOptions: {
          // async: true, // dafaults is false, to compile asynchronous templates set as true
        },
      },
    }),
    
  • fix: handle unsupported value of the preprocessor option
  • refactor: optimize preprocessor code
  • chore: update dev dependencies
  • docs: add description of new features
webdiscus
published 1.9.0 •

Changelog

Source

1.9.0 (2023-03-21)

  • feat: add preprocessorOptions to the loader option to define a custom config for the default preprocessor.
    For all options of the default preprocessor see https://eta.js.org/docs/learn/configuration#big-list-of-configuration-options.
    Usage example:

    new HtmlBundlerPlugin({
      entry: {
        index: './src/views/pages/home.html',
      },
      loaderOptions: {
        preprocessorOptions: {
          // root path for includes with an absolute path (e.g., /file.html), defaults is process.cwd()
          root: path.join(process.cwd(), 'src/views/'),
          // directories that contain partials, defaults is undefined
          views: [
            path.join(process.cwd(), 'src/views/layouts'),
            path.join(process.cwd(), 'src/views/partials'),
          ],
        },
      },
    }),
    
    
  • feat: add resolving a template partial relative to template. For example, there are templates:

    src/views/pages/home.html - the main template
    src/views/pages/includes/gallery.html - the partial used in the main template
    

    You can include the src/views/pages/includes/gallery.html partial in home.html using a relative path:

    <%~ includeFile('includes/gallery.html') %>
    
  • feat: add default template extensions: .hbs and .handlebars.
    The following default template extensions are now supported: /\.(html|ejs|eta|hbs|handlebars)$/

  • feat: add preprocessor value as string ejs to use the preconfigured EJS compiler (ejs package needs to be installed)

  • feat: add preprocessor value as string handlebars to use the preconfigured Handlebars compiler (handlebars package needs to be installed).
    The preprocessorOptions has Handlebars.compile option plus additional options for the build-in include helper:

    • root {string} - root path for includes with an absolute path (e.g., /file.html), defaults process.cwd()
    • views {string|Array<strings>} - directory or directories that contain templates.
      For example:
      preprocessorOptions
      {
        root: path.join(__dirname, 'src/views'),
        views: [
          path.join(__dirname, 'src/views/includes'),
        ],
      }
      
      include a partial without an extension
      {{ include '/partials/footer' }} - the root path relative to defined in the root option
      {{ include 'gallery' }} - the relative path to defined in the views option
    • The following extensions will be automatically resolved by default: .html, .hbs, .handlebars.
      Other options:
    • partials {Object.<[name: string], [file: string]>} - Use the partials as an object to define partials manually.
      The key is a partial name, the value is an absolute path of the partial.
      For example:
      partials: {
        gallery: path.join(__dirname, 'src/views/includes/gallery.html'),
        'menu/nav': path.join(__dirname, 'src/views/partials/menu/nav.html'),
        'menu/top/desktop': path.join(__dirname, 'src/views/partials/menu/top/desktop.html'),
      },
      
    • partials {Array<string>} - Use partials as an array of absolute paths to automatically find partials in these paths.
      Files with the following extensions will be found recursively in the given paths: *.html, *.hbs, *.handlebars.
      For example:
      partials: [
        path.join(__dirname, 'src/views/includes'),
        path.join(__dirname, 'src/views/partials'),
      ],
      
      Note: the partial name is a complete relative path to a file without an extension. This is different from plugins, in which Id is a base directory and filename without extension.
    • helpers {Object.<[name: string], function()>} - the key is a helper name, the value is the helper function.
  • fix: inline a style from the link tag with the attribute as="style", e.g.:

    <link href="style.css?inline" rel="preload" as="style" />
    
  • fix: resolve a script in the link tag with the as="script" or the rel="modulepreload" attributes, e.g.:

    <link href="script.js" rel="prefetch" as="script" />
    <link href="script.js" rel="preload" as="script" />
    <link href="script.js" rel="modulepreload" />
    
  • fix: keep output filename extension, different from .html, e.g. [name].php, #4

  • refactor: optimize code

  • test: add tests for new features

  • docs: add description of new features

webdiscus
published 1.8.0 •

Changelog

Source

1.8.0 (2023-03-18)

  • feat: add asset/source support for SVG to inline it in HTML
  • test: add test to inline SVG using the asset/source type
webdiscus
published 1.7.0 •

Changelog

Source

1.7.0 (2023-03-17)

  • feat: add hot update file to HTML in serv mode when there is no script in template, to reload page after changes
  • chore: update dev dependencies
  • docs: update readme
webdiscus
published 1.6.5 •

Changelog

Source

1.6.5 (2023-03-16)

  • fix: extra fix for yarn fans. Yarn can't correctly install packages form standard npm peerDependencies. move the enhanced-resolve from peerDependencies into dependencies, it is needed for yarn only
  • test: add test for resolving the source manifest.json
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc