W
Wasp3w ago
cmilazzo

head

How do I add a script to the HEAD of an app?
1 Reply
kapa.ai
kapa.ai3w ago
Hi @cmilazzo. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- To add a script to the HEAD of your Wasp app, you can use the head field in your app declaration. This field allows you to include additional lines, such as <script> tags, in the <head> of your HTML document. Here's an example of how to add a script to the HEAD:
app myApp {
wasp: {
version: "^0.13.0"
},
title: "My App",
head: [
"<script src='<https://example.com/myscript.js'></script>">
]
}
app myApp {
wasp: {
version: "^0.13.0"
},
title: "My App",
head: [
"<script src='<https://example.com/myscript.js'></script>">
]
}
You can add multiple items to the head array, including scripts, stylesheets, or meta tags. For instance:
app myApp {
wasp: {
version: "^0.13.0"
},
title: "My App",
head: [
"<script src='<https://example.com/myscript.js'></script>",>
"<link rel=\"stylesheet\" href=\"<https://fonts.googleapis.com/css?family=Roboto:300,400,500&display=swap\"> />",
"<meta name=\"viewport\" content=\"minimum-scale=1, initial-scale=1, width=device-width\" />"
]
}
app myApp {
wasp: {
version: "^0.13.0"
},
title: "My App",
head: [
"<script src='<https://example.com/myscript.js'></script>",>
"<link rel=\"stylesheet\" href=\"<https://fonts.googleapis.com/css?family=Roboto:300,400,500&display=swap\"> />",
"<meta name=\"viewport\" content=\"minimum-scale=1, initial-scale=1, width=device-width\" />"
]
}
This approach allows you to customize the <head> section of your app's HTML document, giving you flexibility to add necessary scripts, styles, or meta information. For more details on customizing your app, including the head field, you can refer to the Customizing the App documentation. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @cmilazzo, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?

Did you find this page helpful?