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

scripts: Reference script templates from other script templates #449

Open
RaniAgus opened this issue Jan 21, 2024 · 0 comments
Open

scripts: Reference script templates from other script templates #449

RaniAgus opened this issue Jan 21, 2024 · 0 comments
Labels
enhancement New feature or request NeedsDecision Issue needs some more discussion so a decision can be made scripts

Comments

@RaniAgus
Copy link

RaniAgus commented Jan 21, 2024

It would be great if we were able to write this:

script mul(a int, b int) {
  return a * b;
}

script double(num int) {
  return @mul(num, 2);
}

And map the function call to the correct script template like this:

<script type="text/javascript">function __templ_mul_5a85(a, b){return a * b;}</script>
<script type="text/javascript">function __templ_double_5a85(num){return __templ_mul_5a85(num, 2);}</script>

So we could reuse logic from both client and server sides.

@joerdav joerdav changed the title [Feature request] Reference script templates from other script templates scripts: Reference script templates from other script templates Jan 22, 2024
@joerdav joerdav added enhancement New feature or request scripts labels Jan 22, 2024
@joerdav joerdav added the NeedsDecision Issue needs some more discussion so a decision can be made label Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request NeedsDecision Issue needs some more discussion so a decision can be made scripts
Projects
None yet
Development

No branches or pull requests

2 participants