Search code examples
angularjsnode-webkit

Add fonts for offline usage in angular?


Angular loads some fonts when starting.

https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700

When I start nodewebkit and I'm offline, it seems that try to load the fonts slows down the app...can I hold this font offline without loading?

Or angular alwasy watch online for this fonts?

Thanks!

enter image description here enter image description here


Solution

  • This is not angular's concern. In HTML5 You can use an appcache for that.

    as noted in http://www.w3schools.com/

    HTML5 introduces application cache, which means that a web application is cached, and accessible without an internet connection.

    create a file beside your index.html named resource.appcache

    add the link to the following files you want to cache inside resource.appcache

    CACHE MANIFEST
    # v1.0.0
    https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700
    

    then in your html, link it like

    <!DOCTYPE HTML>
    <html manifest="resource.appcache">
    ...
    </html>