Getting statics folder URL at runtime?



  • I’m using a thirdparty components that uses some media files (images, audio files, etc.). I should specify what the base url is for those files. For example if i pass to the media prop like so: media="/statics the component will append file name to it to set it as the url of the image or whatever it is (i.e /statics/img.jpg).

    I can’t get the files to load correctly. I think I should get the base url of the statics folder at run time and then pass it to the component. Am i right? How should I resolve this?



  • @ahmadx87 As of q/app v2.x, there is no longer a statics folder. It has been changed to public and is now a sibling to the src folder.
    Please check out the Upgrade Guide to see what else may impact you. https://quasar.dev/quasar-cli/app-upgrade-guide



  • Thanks alot @Hawkeye64 I’ve just recently began using Quasar and had problems getting the file paths correctly. Looks like in v. 2 it is easier to deal with assets.
    I upgraded and it solved my frustration. 👍🎉



  • @ahmadx87 It is easier, especially if you have “extra” assets, like robots.txt, etc


Log in to reply