Can I pass some parameters in require macro?
See original GitHub issueI have a header.html template, It is used on every page, and each page has some differences. This is easy to implement if I can pass some parameters in require macro, like:
index.html
@require('path/to/header.html', { name: 'monine' })
// or
@require('path/to/header.html')({ name: 'monine' })
How can I achieve this?
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Pass Arguments to a Macro Called from a Button or Sheet in ...
To assign a macro that you pass arguments to a button, shape, image, or any object, you first right-click that object and click...
Read more >Passing Simple and Complex Parameters In and Out of Macros
This is fine for simple macros, but when there are multiple parameters, keyword parameters can be helpful. Keyword parameters require the macro call...
Read more >Can I pass Parameters in Execute macro Activity If Yes then ...
I am using a Execute macro activity in uipath studio but without passing parameter it is working fine and call a macro performing...
Read more >how to pass a parameter with macro variables into macro
Pass the names not the value. Then you don't have to worry about quoting in the macro call. Also you can't name a...
Read more >Macro Arguments (The C Preprocessor)
Function-like macros can take arguments, just like true functions. To define a macro that uses arguments, you insert parameters between the pair of ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @emaphp Here’s a new problem with HtmlWebpackPlugin.
header.html
page-a.html
page-b.html
There will be throw a error from HtmlWebpackPlugin:
Template execution failed: ReferenceError: name is not defined
Because of require macro does not provide arguments in page-b.html. but header.html needs it…
Or should I commit this issue to HtmlWebpackPlugin?
Hi, the thread is quite old but still open, just came across it and wanted to share my solution for the problem of
Template execution failed: ReferenceError: name is not defined
. So the workaround is just to ensure the variable exist somewhere before usage: