Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return compiled Handlebars string, no source maps #24

Merged
merged 1 commit into from
Nov 30, 2023

Conversation

mbland
Copy link
Owner

@mbland mbland commented Nov 30, 2023

Originally the compiled template was wrapped as the code: attribute of a return object. However, the only use for returning an object is if we're returning Handlebars source maps.

Upon studying Handlebars source maps more closely, and experimenting locally by introducing errors here and there, they don't seem to be of much use. The existing error messages are fine, and I can't seem to find examples of Handebars source map usage online.

Now options.compiler.srcName and options.compiler.destName are explicitly undefined, to ensure Handlebars.precompile() only returns a string in PluginImpl.compile().

If one day a use case arises where it would make sense to support Handlebars source maps, this should prove relatively straightforward to enable. However, it doesn't seem worth adding even that little bit of complexity now when any such use case isn't yet clear.

Originally the compiled template was wrapped as the `code:` attribute of
a return object. However, the only use for returning an object is if
we're returning Handlebars source maps.

Upon studying Handlebars source maps more closely, and experimenting
locally by introducing errors here and there, they don't seem to be of
much use. The existing error messages are fine, and I can't seem to find
examples of Handebars source map usage online.

Now options.compiler.srcName and options.compiler.destName are
explicitly undefined, to ensure Handlebars.precompile() only returns a
string in PluginImpl.compile().

If one day a use case arises where it would make sense to support
Handlebars source maps, this should prove relatively straightforward to
enable. However, it doesn't seem worth adding even that little bit of
complexity now when any such use case isn't yet clear.
@mbland mbland merged commit 87d3139 into main Nov 30, 2023
3 checks passed
@mbland mbland deleted the handlebars-disable-source-maps branch November 30, 2023 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant