Polymer / tools

Polymer Tools Monorepo
BSD 3-Clause "New" or "Revised" License
430 stars 200 forks source link

how to bundle Roboto web font? #1936

Open cordovapolymer opened 7 years ago

cordovapolymer commented 7 years ago

How to instruct polymer-bundler(I'm using it via polymer build) to bundle Roboto and other external resources? In polymer starter kit 1.0 gulp copy task has been doing this.

justinfagnani commented 7 years ago

@cordovapolymer are you using the font-roboto you linked to, which is very old and only compatible with Polymer 0.5, or the current one here: https://github.com/PolymerElements/font-roboto ?

@usergenic does this sound like we need an option to include certain external resources?

web-padawan commented 7 years ago

As I have already noticed in the other issue, font-roboto can be easily overridden in particular bower.json by font-roboto-local like this without rewriting any HTML imports. I also recommend using gulp-ttf2woff and gulp-replace to serve Roboto fonts in .woff format, this would just require two gulp tasks: one to convert fonts and copy them to build direcory and another one to replace occurcnces.

cordovapolymer commented 7 years ago

@justinfagnani , you are right I've linked to a wrong font-roboto, I'm using the new one

justinfagnani commented 7 years ago

Yeah, I know about font-roboto-local, but that's a fairly one-off solution, and not really ideal for most web projects anyway, who probably should be using Google's CDN for cacheability. I think it'd be great if we had something that worked with external resources in general.

btw, @web-padawan are you building an Electron app or similar? That's the main use case for font-roboto-local.

web-padawan commented 7 years ago

@justinfagnani no, just a plain SPA with app-shell architecture served via nginx with no backend (only API requests). But we don't rely on service worker for now (because of Safari) and use fingerprinting assets via gulp-rev-all instead. So we decided to ship fonts from our repo as well (they get fingerprinted once and should be cached permanently).

cordovapolymer commented 7 years ago

@justinfagnani , the are other use cases, we are building a cordova based app.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.