Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Support per-page HTML template customisation via 'mains' #1029

Merged
merged 2 commits into from Aug 21, 2018
Merged

Support per-page HTML template customisation via 'mains' #1029

merged 2 commits into from Aug 21, 2018

Commits on Aug 21, 2018

  1. Support per-page HTML template customisation via 'mains'

    This adds support for defining each entry point in `mains` as an
    object, where the path to the entry point is now defined under an
    `entry` property, and any other properties can be used by presets
    for page-specific options. (The short form using a string is still
    supported.)
    
    In the case of `@neutrinojs/web` (and presets that inherit from it),
    these additional properties are then used to override the options
    passed to `html-webpack-plugin`, allowing for page-specific
    customisation of the generated HTML template.
    
    For example:
    
    ```
    module.exports = {
      options: {
        mains: {
          index: {
            entry: './index',
            // Options here take priority over the preset's `html` options below.
            title: 'Site Homepage',
          },
          admin: {
            entry: './admin',
            title: 'Admin Dashboard',
          },
          account: {
            entry: './user',
            inject: true,
            template: './my-custom-template.html',
          },
        }
      },
      use: ['@neutrinojs/web', {
        // Customise the defaults used for all pages.
        html: {
          minify: false,
        }
      }]
    }
    ```
    
    For a list of the available `html-webpack-plugin` options, see:
    https://github.com/jantimon/html-webpack-plugin#options
    
    Fixes #865.
    edmorley committed Aug 21, 2018
    Copy the full SHA
    91d68c9 View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    e4c944d View commit details
    Browse the repository at this point in the history