Replies: 14 comments 29 replies
-
|
Hello @vralle, Thanks for your feedback and for sharing your complex usage example. |
Beta Was this translation helpful? Give feedback.
-
|
Hello @webdiscus
There are a few broader questions that I believe are deeply connected to the adoption of tools like
These two points are closely related. In fact, I believe Webpack itself has faced some community friction due to the sheer diversity and complexity of its ecosystem. While it's incredibly powerful, that power often comes at the cost of accessibility. One potential way to attract more users could be to position this plugin explicitly as a tool for deep optimization. That’s exactly what it already excels at. And in an era where even Google and modern AI-driven platforms struggle with bloated or poorly structured websites, this kind of control is more relevant than ever-though I suspect the results may not always be immediately impressive to the average developer. That said, I personally consider this plugin irreplaceable when a project demands full control and deep optimization of HTML, CSS, JS, and assets. It fills a critical gap that most modern frameworks simply don’t address. Thanks again for your work on this - it's a rare and valuable piece of tooling. |
Beta Was this translation helpful? Give feedback.
-
|
I’ve been thinking a lot about template engines lately, especially after working with Astro. It gave me some fresh ideas about how this plugin might be improved. Even though the plugin is a powerful tool, the template engines are definitely the weakest link in the pipeline. For example, Eta has a few limitations:
Astro solves many of these problems out of the box, but right now I’d love to focus on one thing: importing inside templates. The plugin does support Markdown imports although that part isn’t documented. I’ve made my own Eta fork to add Markdown support. Working with different content file formats made me think:
This way, we could use Webpack loaders for Markdown, MDX, Front Matter, or anything else. and benefit from full compatibility and flexibility. @webdiscus, I’d love to hear your thoughts on this idea and any insights into how tricky it might be to implement. Let me know if you want help sketching it out or experimenting with a proof of concept! |
Beta Was this translation helpful? Give feedback.
-
|
@webdiscus, just to be objective - I don’t have much experience with different template engines. Right now, Eta is my main templating tool, and it’s the only one I can confidently speak about based on actual usage. Currently, the most obvious way to handle different file formats in Eta is by extending its class. Eta uses
I’ve also been thinking about the simplest path: creating custom content integration mechanisms that can be injected into Eta through the data object, like: data: {
mdLoader,
mdxLoader
}This wouldn’t integrate with Webpack, the transformations would remain isolated. |
Beta Was this translation helpful? Give feedback.
-
I've was trying with Eta. And import doesn't woks either. {{ const content = import("../content/privacy-policy.md") }}
{{~ content.default }}Result: import() runs from Eta location (workspace), and knows nothing about package with site |
Beta Was this translation helpful? Give feedback.
-
|
@webdiscus, I'm confusing. Webpack Loaders: {
test: /\.md$/,
use: [
{
loader: "remark-loader",
options: {
remarkOptions: {
plugins: [RemarkHTML],
},
},
},
],
},The plugin: preprocessor: "eta",
preprocessorOptions: {
cache: false,
cacheFilepaths: false,
defaultExtension: ".html",
rmWhitespace: true,
tags: ["{{", "}}"],
useWith: true,
views: join(projectPaths.src, "views"),
},In template: Now I'm confusing ( |
Beta Was this translation helpful? Give feedback.
-
Here it is with original regexp: https://regex101.com/r/LRKCKU/3 |
Beta Was this translation helpful? Give feedback.
-
|
I’ve added some more logging. At the moment, all I know is that include("file.md) for some reason doesn’t hit either the loadFile() method overridden by the plugin, or preprocessor.compile() It’s possible I’m making a mistake in the regular expression. |
Beta Was this translation helpful? Give feedback.
-
|
@webdiscus, I'm going to take a break and investigate why compilation fails in my current setup. So far, the only possible cause I'm considering is that multiple Eta instances are being used during compilation, or that caching is involved since not all files show up in the logging output. |
Beta Was this translation helpful? Give feedback.
-
|
First +: |
Beta Was this translation helpful? Give feedback.
-
|
Step 2: I've added |
Beta Was this translation helpful? Give feedback.
-
|
@webdiscus, In my view, these changes offer a more systematic approach to versioning and content transformation, all without touching the core templating logic. This version of Eta makes it possible to externalize the transformation hook into config, or even wire it into a Webpack pipeline. Total freedom for handling transformations: developers can define exactly which processors they want to use. Would love to hear your thoughts! |
Beta Was this translation helpful? Give feedback.
-
Hmm. Image links and more in templates are handled very efficiently by the plugin. template-part.html: <meta name="twitter:image" content="{{= meta.twitterCard.image }}" />
<meta property="og:image" content="{{= meta.openGraph.image }}">
<link href="@src/img/branding/safari-pinned-tab.svg" color="#0f3341" rel="mask-icon">
<link href="@src/site.webmanifest" rel="manifest">All file types is configured in Webpack loaders and the plugin's |
Beta Was this translation helpful? Give feedback.
-
|
@webdiscus, I’ve started a project using a plugin and Nunjucks. |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
Hi folks!
I’ve been working with Astro over the past few months on several production projects, and I wanted to share my experience - not just highlighting the fantastic developer experience it offers but also discussing some limitations and how I’ve worked around them. I’m opening this thread to hear how others in the community are approaching similar challenges, and to thank the author of
html-bundler-webpack-pluginfor a truly excellent tool.What Makes Astro a Joy to Work With
Together, these features make for a fantastic DX. The framework feels natural, intuitive, and pleasant to work with - whether you're prototyping or building a full-scale product.
Where Things Get Tricky: Asset Handling & Output Control
Astro provides some support for output file renaming (via Rollup settings), but it's limited. In particular:
Additionally:
Solution: Webpack + html-bundler-webpack-plugin for Deep Optimization
To regain full control over the final production output, I’ve adopted a hybrid approach: exporting the Astro build and feeding it into Webpack with
html-bundler-webpack-plugin.This enables deep, layered optimization across the entire project, including:
This approach bridges the gap between Astro’s excellent DX and real-world production needs-giving me the confidence that the final bundle is clean, consistent, and secure.
@webdiscus, huge thanks for creating such a powerful tool - it has become essential in my build workflow 🙏
Beta Was this translation helpful? Give feedback.
All reactions