- feat: drop support of the Node < 16, the loader can still works with the Node 14.x >=, but we test only with Node >= 16.16
- feat: add support the version
14.x
of themarkdown-it
in filters - feat: add new
mode
option. Use it instead of the DEPRECATEDmethod
option name. - feat(DEPRECATION): the
method
option is renamed intomode
. Themethod
option can be used until the next major version. - feat: add new names for new
mode
option:compile
,render
,html
. - feat(DEPRECATION): the
pug-compile
,pug-render
,pug-html
method/mode names are deprecated! This method/mode names can be used until the next major version. - fix: decode URL params
For example:
from the query
partial.pug?render&text=Hello%20World%21
will be parsed thetext
parameter asHello World!
. - fix: detecting correct error case by load built-in filter
- chore: remove DEPRECATION message when the
pug loader
is used withhtml-webpack-plugin
, for reasons of humanity the support of thehtml-webpack-plugin
still stay.
For developers is recommended to use the modern powerful pug-plugin. - refactor: code refactoring
- test: add test for include a file in the highlight filter
- docs: improve the readme
- fix: caching user data from html-webpack-plugin by template filename with query
- fix: add the svg file referenced with a fragment, e.g.
icons.svg#home
, to watch dependencies - chore: update packages
- fix(for pug-plugin): add missing node modules to compilation after rebuild
- fix: correct loader export when template contain CRLF line separators
- fix(for pug-plugin): resolving of inline JS source file
- feat(for pug-plugin): add supports for inline JS
- refactor: code optimizations
- feat: resolve required resources in attribute blocks:
img&attributes({ src: require('./image.png'), srcset: `${require('./image1.png')} 80w, ${require('./image2.png')} 90w`, })
- chore: update packages
- fix(for pug-plugin): set correct asset name of script for multi-lang pages
- fix(for pug-plugin): store unique script and set actual asset name of script by HMR
- fix: passing
data
option when theself
options is true in compile method - refactor: optimize code
- chore: update development packages
- test: add tests for data and self options
- fix: resolving of assets in pug templates with url query
- chore: update packages
- chore: add peerDependenciesMeta to package.json for optional modules
- fix: resolve modules whose package.json contains
exports
field - fix: added minimal required version of
enhanced-resolve
inpeerDependencies
to avoid using incompatible version by other modules - chore: update packages
- fix: fixed last stable version of ansis in package.json to avoid issues in dependency
- feat: add resolving for require in conditional, e.g.:
if condition img(src=require('./image1.png')) else img(src=require('./image2.png'))
- feat: add resolving for require in mixin argument, e.g.
+image(require('./logo.png'), 'logo')
- feat: add resolving for require in
each in
and ineach of
iteration object, e.g.each [key, img] of new Map([['apple', require('./apple.png')], ['sony', require('./sony.png')]])
- refactor: replace pug-walk lib with optimized up to x2.5 faster implementation without recursion
- test(BREAKING): drop support for Node v12, because lastest
jest
v29 supports Node.js >= 14.15.0.
- chore: optimize script store for pug-plugin
- feat: add supports for a string value by the
watchFiles
option - fix: resolve style in Pug from node_modules by module name, e.g.:
link(href=require('bootstrap') rel='stylesheet')
- chore: inner optimisations for using with the pug-plugin
- feat: add resolving of file alias for scripts and styles
- feat: improve resolving of script files specified w/o extension
- feat: improve performance
- fix: allow to use url query in script source file
- fix: resolving of absolute path using root context
- fix: resolving of alias to file using root context
- chore: optimize for using with pug-plugin
- chore: using html-webpack-plugin with Pug is deprecated, use pug-plugin) instead
- refactor: optimize code
- tests: add test cases and optimize test fixtures
- fix: HMR issue on Windows
- fix: remove unused module
- feat: display the error message on broken page due to fatal error
- feat: add HMR support on broken page due to fatal error
- fix: issue by resolving Pug aliases on Windows
- fix: warning by watching interpolated dependencies with
compile
method - refactor: replace polyfill for replaceAll() with regexp replace()
- fix: add supports for webpack resolve modules
- fix: parse require() value with complex interpolation
- fix: encode reserved chars for resource query
- fix: add support the prefixes
~
@
for file alias
- feat: add support the resolving a file alias in
include
- feat: add
watchFiles
option to watch for file changes in resolved dependencies - fix: in
:markdown
filter enable HTML tags in markdown source
- docs: update readme
- feat: add support the Pug in Vue
- feat: add support an indent in Vue template for Pug code
- chore: add usage example for Pug in Vue template
- test: add test for remove unexpected indents in Vue template
- feat: add embedded filter
:markdown
with highlighting code blocks
- fix: pug error in dependency requires restart of webpack, #14
- feat: add embedded filters
:code
,:highlight
- fix: add
&
and"
chars in:escape
filter
- fix: support resolving npm modules in pug template
- feat: add the
embedFilter
option to enable using in pug filters embedded in pug-loader - feat: add embedded
:escape
filter to escape HTML tags - test: add test for
:escape
filter
- feat: added supports the require() of the javascript source files directly in pug (works only
with pug-plugin).
It is no longer necessary to define a js file in webpack entry-point. For example, using thepug-plugin
now following is possible:Generated HTML:script(src=require('./main.js'))
<script src='/assets/js/main.1234abcd.js'></script>
- feat: add support a function in loader option
data
forcompile
method.
- feat: resolve the variable contained a subdirectory in the relative path
- var file = './subdir/image.jpg'; img(src=require(file))
- feat: resolve a required path in the variable
- var file = require('./subdir/image.jpg'); img(src=file)
- feat: watching of required
js
andjson
files in pug
- chore: code refactoring and internal optimization
- docs: update readme
- fix: collision with local variables passed in template function for compile method
- fix: path error in Windows when watching dependencies
- chore: update packages
- feat: add supports for webpack alias as array of paths, #10
- fix: optional prefix of alias in request when an alias name self contains the prefix
- BREAKING CHANGE (low probability): limiting for the method
compile
by resolving a variable in the argument of require() used in pug, see resolve resources .
The methodsrender
andhtml
are not affected. - fix: change the evaluation to interpolation of required files for
compile
method to fix issueundefined variable
- fix: issue
undefined variable
for methodcompile
by use the variables in pug w/o optional chaining - test: add tests for the
compile
andrender
methods - chore: update packages
- feat: add supports the
htmlWebpackPlugin.options
in pug template, #8 - test: add test case for require fonts in pug template
- refactor: tests
- feat: improve error message due to template function failure
- refactor: exceptions
- docs: update readme
- fix: the path of dependencies in windows
- chore: update npm packages
- feat: add supports for resolving of aliases from webpack
resolve.plugins
by required resources, like styles, scripts - feat: add supports for resolving of
srcset
attribute inimg
tag - fix: improve resolving the required files by all methods
- fix: resolving issues by usage the variable filename contained parent relative path in require() function
- refactor: optimize source
- test: add test cases to improve test coverage
- feat: add supports for resolving of aliases from webpack
resolve.plugins
by include / extends if a file is by webpackresolve.alais
not resolved, then uses the slow enhanced resolver - chore: update packages
- fix: path resolving on Windows
- refactor: optimize code
- feat: the
pug-loader
is now the part of the pug-plugin. - feat: add the option
basedir
for all absolute inclusion - test: add the test for new option
basedir
- test: refactor tests
- test: add tests for an exception and an option
- test: refactor test utils
- docs: update readme
- chore: remove needles console.log, cleanup code
- chore: update packages
- feat: improve the
render
andhtml
methods - fix: require() for CommonJS module. Now is possible use the CommonJS module directly in the pug, e.g.:
- var someModule = require('some-module'); p #{ someModule.sayHello('PUG') }
- fix: 'Unexpected token' by render method
- fix: 'Unterminated string' by render method
- feat: add the polyfill
replaceAll()
for node.js < 15 - fix: the parsing multiple
require
in a single string code
- refactor: cleanup code
- feat: add supports for require of JS and JSON data files in pug at compile time, e.g.:
- var someData = require('some-data.json'); each item in someData p= item.anyProperty
- fix: issues by samples
- refactor: inner optimizations for the
render
method
- feat: add the option
esModule
to enable/disable ES modules syntax in generated JS modules - refactor: code improvements
- chore: update packages for examples
- feat: the
render
method has been improved. Now the method render a pug into HTML really at compile time without limitations for resolving an embedded resource. This method do same result as any other pug-loader + html-loader, even faster, generate smaller code and with all that not need an additional loader. - refactor: improve code
- feat: add the new loader method
html
to render the template function into pure HTML string,
this method require additional loader, e.g.html-loader
- chore: add directory with samples for usage this loader with Angular Component
- fix: config for tests
- chore: cleanup tests
- feat: added supports for usage of
compile
orrender
methods in JavaScript:- added loader option
method: render|compile
to render into HTML or compile into a template function all templates required in js file - in the js require() can be used the query parameter
?pug-render
to render the pug template directly into HTML, independent of loader optionmethod
,
e.g.const html = require('template.pug?pug-render')
- in the js require() query can be used the query parameter
?pug-compile
to compile the pug template into a template function, independent of loader optionmethod
,
e.g.const tmpl = require('template.pug?pug-compile')
- added loader option
- feat: added the passing a custom data into a template at compile time:
- added loader option
data: {}
to pass a data into all templates at compile time, e.g. useful for the i18n data - in the js require () query you can use URL
key=value
or JSON{key:value}
parameters to pass them into the template at compile time,
e.g.const tmpl = require('template.pug?key1=value1&{"key2":"value2","key3":"value3"}')
- added loader option
- chore: update dependencies in package.json
- fix: add missed dependency for test
- chore: update dependencies for test
- docs: update readme
- test: add the test case to cover
the
pugjs/pug-loader
issue :Module not found: Error: Can't resolve
when use a mixin and require on same file.\
- chore: update packages
- docs: update readme
- refactor: cleanup code
First release
- supports Webpack 5 and Pug 3
- supports all features and options of original
pugjs/pug-loader
- up to 4x faster than original
pugjs/pug-loader
at webpack starting - up to 8x faster than original
pugjs/pug-loader
at webpack watching during compile changes in dependencies - supports Webpack
resolve.alias
, work fine with and without the prefixes~
or@
, e.g. this works:extends UIComponents/layout.pug
extends ~UIComponents/layout.pug
extends @UIComponents/layout.pug
include UIComponents/mixins.pug
include ~UIComponents/mixins.pug
include @UIComponents/mixins.pug
include:markdown-it UIComponents/components.md
- const colors = require('UIComponents/colors.json')
img(src=require('UIComponents/image.jpeg'))
const tmpl = require('UIComponents/index.pug');
- supports watching of changes in all dependencies
- all features have integration tests processed through a webpack runner