Integrate 3rd-party <script> objects
Certain 3rd party integrations require adding a <script> object to the index.html file. How can I do this with Wasp, given that the index.html file is generated dynamically?
2 Replies
Hi @Anima. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
To integrate third-party
<script>
objects in a Wasp application, you can use the head
field in your app
declaration within the main.wasp
file. This allows you to add custom elements to the <head>
section of your generated HTML file.
Here's how you can do it:
1. Open your main.wasp
file.
2. Locate your app
declaration.
3. Add or modify the head
field to include your third-party script.
Here's an example of how to add a script to your app:
You can add multiple scripts or other HTML elements by including more items in the head
array:
This approach allows you to add third-party scripts and other elements to your app's HTML without directly modifying the dynamically generated index.html
file.
Source: Customizing the App (https://wasp-lang.dev/docs/project/customizing-app)
Remember that this method injects the scripts into every page of your app. If you need more granular control or page-specific scripts, you might need to explore alternative solutions or wait for more advanced features in future Wasp versions.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Anima, 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?Good bot