You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be really awesome if you could add functionality similar to that of html-loader.
html-loader parses the html and automatically adds assets as dependencies. Something similar should be possible for pug.
TMK this happens on the basis of a list of tags and attributes that should be treated as assets.
Adding this functionality would eliminate the need to use require for assets making the DX even more awesome.
(parcel also does this. HTML as entypoint with automatic asset loading)
Using require for assets could ideally still be optionally possible.
When we need to define a static assets (vendor scripts, vendor css, vendor images, etc) these already are in public directory, then we can write this public path without require():
How can we differentiate the path when we should leave it as it is and when we should compile the sources?
I known, html-loader has a filter option, where we can write a function and self decide, but is very bad practice. Easily is use the require() for source files and not use it for static assets.
I see only one case for " leave it as is", it is URL like:
Activity
webdiscus commentedon Jun 13, 2022
@m10
Thank for good idea :-)
We can discuss it.
require():require():How can we differentiate the path when we should leave it as it is and when we should compile the sources?
I known,
html-loaderhas a filter option, where we can write a function and self decide, but is very bad practice. Easily is use therequire()for source files and not use it for static assets.I see only one case for " leave it as is", it is URL like:
But what should be with others?