Cumulative Release v4.1.0 - v4.9.9
Features
-
Added support of an inline script using the
?inlinequery. -
Resolve required resources in attribute blocks:
img&attributes({ src: require('./image.png'), srcset: `${require('./image1.png')} 80w, ${require('./image2.png')} 90w`, })
-
Added the
js.verboseoption to display extract info. -
Added the
js.outputPathoption:new PugPlugin({ js: { verbose: true, filename: '[name].[contenthash].js', outputPath: 'assets/js/', }, }),
-
Added short option name
cssas alias forextractCssoption.
Now use the new option namecssinstead ofextractCss:new PugPlugin({ css: { filename: 'assets/css/[name].[contenthash].css', }, }),
-
Added new
jsoption withfilenameproperty as alias for Webpackoutput.filename:new PugPlugin({ js: { filename: 'assets/js/[name].[contenthash].js', }, }),
The
js.filenameoption has prio overoutput.filenameoption. -
Added resolving url() in inlined CSS using the
?inlinequery
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 inand ineach ofiteration object. -
display details verbose data for extracted CSS, images, data-URL, inline SVG, etc.
-
Added the
filenameproperty to thepathDataargument of thefilename(pathData)function in entry object.
DEPRECATIONS
- Use the
cssoption name instead of theextractCss. - The outdated syntax of CSS option is deprecated, and in next version will be removed:
Use the new syntax, since
new PugPlugin({ modules: [ PugPlugin.extractCss({ filename: 'assets/css/[name].[contenthash].css', }), ], }),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
prettyoption is true. - Inline SVG in link tag as data-URL.
- Resolve inlined styles on windows.
- Resolve the
js.filenameoption when used split chunk. - Resolve the asset path when used the
css.outputPathoption. - When
css.filenameis a function, pass thepathData.filenameproperty as a source file. - Fixed CSS output path when
publicPathhasautovalue. - Generate correct script asset filename by HMR after changes, sometimes filenames are mixed up between files.
- Pass
datain loader option when theselfloader option is true in thecompilemethod. - Fixed source map in inlined CSS.
- Set default value of
output.pathaspath.join(__dirname, 'dist'). - Set default value of
output.filenameas[name].js. - Resolve assets in pug templates with an url query.
- Resolve modules whose package.json contains
exportsfield. - 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.filenameproperty 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.