Problem requesting fonts in OnsenUI/vue-cordova-webpack template



  • I am trying out the OnsenUI/vue-cordova-webpack template template and am running into an issue serving font files.

    Below you can see that the files are served properly, but requested with an incorrectly appended /static/css appended to the path.

    I understand why the requests are made that way, see 3rd screenshot, but don’t know how to fix it?

    Thanks!

    2_1498508749959_served.png

    1_1498508749959_requested.png

    0_1498508749958_path.png


  • Onsen UI

    @denious Hi! Thanks a lot for reporting. I assume this is during development, right?
    Check this line and try to play a little bit with it, perhaps adding '/' at the very end instead of ''. It worked during my development test but I’ll check again.

    If you wonder why it is different for development and production, well, Cordova uses file://some/path/www/... for serving files so we cannot use absolute paths, it must be relative.


  • Onsen UI

    I’ve tested it again both in development (npm run dev) and production (npm run build and then manually serving the resulting www directory) and both work well.
    I get:

    [Tue Jun 27 2017 09:16:07 GMT+0900 (JST)] "GET /static/fonts/ionicons.dd4781d.ttf" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36"
    
    

    :no_mouth:



  • Hi, Fran,

    Thanks a lot for your quick response, your first suggestion fixes the problem! :+1:


  • Onsen UI

    @denious Good to read that. I think '/' should be more robust for development so I just updated it :+1: