ajnin
ajnin
SSolara
Created by ajnin on 7/9/2024 in #questions-issues
**Issue with Loading Static JavaScript and CSS Files Using `<script>` Tags in Solara**
Hello, I followed the docs - https://solara.dev/documentation/advanced/reference/static-files https://solara.dev/documentation/advanced/reference/asset-files The issue I am encountering with fetching static files inside a <script> tag in a Solara component. Here’s the scenario: I am using the solara.HTML component to include HTML content within my Solara application: solara.HTML(tag="div", my_html) In the my_html variable, I have included a script tag to load a JavaScript file: <script src="/static/assets/dhtmlxgantt.js"></script> The problem is that the JavaScript file (or any CSS file (I did this just to verify)) specified in the <script> tag does not get loaded. However, when I provide these paths using a <link> tag for CSS or JS, the files are available and load correctly. Could you please assist with how to properly serve and access static JavaScript files within Solara when using the <script> tag? Thank you!
2 replies
SSolara
Created by ajnin on 6/3/2024 in #questions-issues
loading static JS file
Hi Team I'm doing a POC to integrate dhtmlx gantt chart inside Solara. my project directory structure - project-root/ | |---app.py |---sol.py |---static/ | |---public/ | |---dhtmlxgantt.js | |---dhtmlxgantt.css I'm mounting the static folder, check below code from fastapi import FastAPI app = FastAPI() app.mount("/static", StaticFiles(directory="static"), name="static") later mounted the app too when I'm trying to access the static file inside my html solara.HTML(mycustomhtml) it always and only mounts the css file and skips the js file also I keep getting 404 error in console for solara_app/static/base/js/namespace.js & solara_app/static/base/js/utils.js please guide me here, how to fix this
22 replies