Open Kruithne opened 1 year ago
stuff like this should be solved by macros; in this case you can have a vue
macro. we cant ever unconditionally do this on all template strings, because it will most definitely break library code.
i can't close the issue because macros still have servere issues affecting this use case:
this is a problem i noticed when working on https://bun.report, which doesn't use a framework nor any tooling; it is just a call to Bun.build
. the frontend code includes dynamic HTML strings:
the way i worked around it was to use a crazy regular expression to minify the templates anyways.
this type of hack works for small projects but wont ever scale up. the macro system is begging to be used for something like this. unfortunately, i don't have time to implement the above changes anytime soon, but i do want to serialize my thoughts so they're in writing. apologies for long delay in this.
What is the problem this feature would solve?
When using the
bun build --minify
, template literals are not minified. This makes sense from a safety standpoint, however an optional method of at least compacting the whitespace within templates would be beneficial. On a large codebase with many components, the minified result contains large inflated sections of HTML which could reduce the bundle size considerably.What is the feature you are proposing to solve the problem?
Optionally minify whitespace within HTML template literals. This would need to be done with some safety to prevent intentional whitespace within elements from being removed.
What alternatives have you considered?
No response