Skip to content

v4.9.9

Latest
Compare
Choose a tag to compare
@webdiscus webdiscus released this 12 Aug 16:13
· 18 commits to master since this release

Cumulative Release v4.1.0 - v4.9.9

Features

  • Added support of an inline script using the ?inline query.

  • Resolve required resources in attribute blocks:

    img&attributes({
      src: require('./image.png'),
      srcset: `${require('./image1.png')} 80w, ${require('./image2.png')} 90w`,
    })
  • Added the js.verbose option to display extract info.

  • Added the js.outputPath option:

    new PugPlugin({
      js: {
        verbose: true,
        filename: '[name].[contenthash].js',
        outputPath: 'assets/js/',
      },
    }),
  • Added short option name css as alias for extractCss option.
    Now use the new option name css instead of extractCss:

    new PugPlugin({
      css: {
        filename: 'assets/css/[name].[contenthash].css',
      },
    }),
  • Added new js option with filename property as alias for Webpack output.filename:

    new PugPlugin({
      js: {
        filename: 'assets/js/[name].[contenthash].js',
      },
    }),

    The js.filename option has prio over output.filename option.

  • Added resolving url() in inlined CSS using the ?inline query
    USAGE CHANGES since v4.4.0
    Pug template

    //- to inline CSS use exact the `?inline` query
    style=require('./styles.scss?inline')

    use Webpack config without the type asset/source

    {
      test: /\.(css|sass|scss)$/,
      use: ['css-loader', 'sass-loader'],
    }
  • Added support for the inline CSS w/o supporting of url().

  • Added resolving for require in Pug conditional.

  • Added resolving for require in Pug mixin argument.

  • Added resolving for require in Pug each in and in each of iteration object.

  • display details verbose data for extracted CSS, images, data-URL, inline SVG, etc.

  • Added the filename property to the pathData argument of the filename(pathData) function in entry object.

DEPRECATIONS

  • Use the css option name instead of the extractCss.
  • The outdated syntax of CSS option is deprecated, and in next version will be removed:
    new PugPlugin({
      modules: [
        PugPlugin.extractCss({
          filename: 'assets/css/[name].[contenthash].css',
        }),
      ],
    }),
    
    Use the new syntax, since v4.6.0:
    new PugPlugin({
      css: {
        filename: 'assets/css/[name].[contenthash].css',
      },
    }),
    

Bug Fixes

  • Resolve filename containing a URI fragment, e.g.:
    use(href=require("./icons.svg#home"))
  • Fixed missing slash in output filename when publicPath is an url.
  • Added missing node modules to compilation after rebuild, #65.
  • Correct inline JS when used split chunks.
  • Correct loader export when template contain CRLF line separators.
  • Remove info comments before inlined SVG.
  • Fixed error after the process when in the template are no scripts.
  • Auto publicPath must be empty string when used HMR.
  • Fixed corrupted inline JS code when code contains '$$' chars chain.
  • Resolve an inline script when the pretty option is true.
  • Inline SVG in link tag as data-URL.
  • Resolve inlined styles on windows.
  • Resolve the js.filename option when used split chunk.
  • Resolve the asset path when used the css.outputPath option.
  • When css.filename is a function, pass the pathData.filename property as a source file.
  • Fixed CSS output path when publicPath has auto value.
  • Generate correct script asset filename by HMR after changes, sometimes filenames are mixed up between files.
  • Pass data in loader option when the self loader option is true in the compile method.
  • Fixed source map in inlined CSS.
  • Set default value of output.path as path.join(__dirname, 'dist').
  • Set default value of output.filename as [name].js.
  • Resolve assets in pug templates with an url query.
  • Resolve modules whose package.json contains exports field.
  • Fixed last stable version of ansis in dependency.
  • Resolve outdated asset filenames after rebuild via webpack dev server, #42.
  • Correct resolve output path of url() in CSS with relative public path, if the public path is relative, then an output path of asset required not in Pug file will be auto resolved relative to the issuer.
  • Fixed info.filename property of postprocess() argument for pug files.
  • Fixed entry filename as a function is replaced by the resolved asset name to avoid redundant calling of the filename function by access to the filename property.
  • Prevent to webpack generate needless alternative requests for pug files to avoid double compiling some pug files containing the require() function.
  • Resolve style in Pug from node_modules by module name, e.g.: link(href=require('bootstrap') rel='stylesheet').
  • Avoid generating a needless runtime code of css-loader in user js file when specified both style and script with using splitChunks.