We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi,
Please help. I have this master.ejs layout :
master.ejs
<!DOCTYPE html> <html> <head> <title>The title</title> </head> <body> <%- body %> <!--Lots of script--> <script src="/a.js"></script> <script src="/b.js"></script> <script src="/c.js"></script> <script src="/d.js"></script> <!--Additional script--> <%- block('script') %> </body> </html>
How do I add another multi-line long script inside block('script')? Consider I have this partial view :
block('script')
<% layout('master') %> <!-- For body --> <div>BODY</div> <!--For script --> <% block('script').append("<script>") %> <% block('script').append("console.log('hello world!');") %> <% block('script').append("console.log('another line!');") %> <% block('script').append("<script>") %>
It's less readable and very tedious. Also, I'm gonna need to inject variables to this JS. Any suggestion?
Thanks before!
The text was updated successfully, but these errors were encountered:
Nevermind. I solve it by creating script file, and call it from the partial view.
<%- block('script').append(partial('script.ejs', { data: data })) %>
Sorry, something went wrong.
why not write <script>your code</script> directly?
<script>your code</script>
Because the order of the scipts matter, and I can't write script directly because it will show before <script src="/a.js"></script>
script
<script src="/a.js"></script>
No branches or pull requests
Hi,
Please help. I have this
master.ejs
layout :How do I add another multi-line long script inside
block('script')
? Consider I have this partial view :It's less readable and very tedious. Also, I'm gonna need to inject variables to this JS. Any suggestion?
Thanks before!
The text was updated successfully, but these errors were encountered: