Is there a way to have build just pass files on as they are?

I have a client using fonts from https://www.typography.com (which I would not recommend, but that’s beside the point), these fonts need to be hosted by us. Great, except that middleman --build chokes on these files. I don’t want to use --no-clean, as I do want build to clean up old stuff, and ignore doesn’t work either. Is there a way to tell MM to just pass this folder along to the corresponding place in the build folder when it builds?

Is that not what happens? I thought that files with extensions that Middleman does not have a renderer for where just passed along. What extensions are on the files in question?

If it does not work, maybe you can ignore (link) the folder and then move it with after_build (link).

That may be how it should work, but there are CSS files in the folder, they just aren’t real CSS files so they error out (Invalid CSS after "…AAARAAAAABAA==). Basically, it’s some sort of encrypted DRM stuff that points you the place the fonts are really being hosted, so not only do you buy the fonts, but then you pay a pretty spendy bit for bandwidth too. Have I mentioned how much I hate how Hoefler and Jones are doing this yet? (But Gotham is a really nice font.)

The ignore is pretty straight forward, I’ll see if I can figure out how to move them on the after_build, thanks much for linking those.

File a bug with a link to a repository that has this problem, and we can look into what’s going on.

I don’t think it’s a bug. MM is doing what it should be, it’s seeing a CSS file (that isn’t really a CSS file, it’s encrypted), and it’s trying to do something with it. The real issue is the font house, but that’s another forum. Tommysundstro’s approach should work well, I actually don’t know Ruby well enough to write the second half of that (moving the files after build), but that should work. I’ll either have it moved after build via MM, or do it via Capistrano.

I’ll post back after we get it working so that if someone else has a similar issue, they at least have a head start.

Hey @javaporter I just came across your same problem and was wondering if you ever found a solution or just started using something different than typography.com?

Thanks!

Hello @dikaio, that site ended up being a full-blown Rails site. But before that transition I think the fix was that I just put the fonts on S3. It’s been a while though.

That’s the first and last time I ever used typography.com, I’m not a huge fan of their delivery model. What font are you using, it might be easier to just find a suitable replacement?

@dikaio, using builder in after_build requires reading some documentation. But straightforward system-level operations are working too. Here is my fragment from actual project. This is a temporary solution of some problem, but it works.

# After build hooks
after_build do |builder|
  print "After_build fixes... "
  system("rm #{config[:build_dir]+'/css/LatoLatin*.css'}")
  system("rm #{config[:build_dir]+'/css/novocento_sans_wide.css'}")
  puts "done."
end

In your case change rm to some copy operation.

Thanks @javaporter I think you’re right about using typography.com, the fonts are great but they way you need to verify use of fonts makes it difficult to use. I usually use Typekit but we decided to use Gotham so here I am :wink:

Thank again!

Very nice, thanks for the snippet @komor72!

I ran into the same issue for http://www.appsagainstebola.org/.

Typography.com has a terrible delivery model, but they do have awesome fonts. I wasted a lot of time trying to make it work with Middleman. Eventually I just gave up and hosted the fonts on an S3 bucket.

I agree, their fonts are great, but not worth the hassle. I love (LOVE) Gotham, but it’s just not worth the hassle for me. I’m using Proxima Nova (through Typekit) where I’d usually use Gotham now. I know it’s not drama, but it’s nice, and it’s a lot easier to deal with Typekit fonts.

@Philip_joubert / @javaporter / @komor72 I just recently came across font prep so for those projects that absolutely depend on Gotham that might be the bet route, its what I did for this project. Anyhow thanks for all the feedback guys.

Interesting project. But let’s keep in mind that many fonts may have restrictions in licence to print and pixel output, excluding web-publishing of the font itself.

You’re right @komor72 Typography.com’s official response:

Thanks for getting back in touch about using webfonts! Cloud.typography ultimately requires that webfonts are used through CSS, and self-hosting computer fonts is not permitted. That said, we recommend placing Production mode font folders outside the build set up as they’re likely to not need so many updates. Once this is done it should allow you to deploy changes to the site without needing to constantly republish projects.

I’m guessing the best way to solve this is using:

activate :asset_hash, :ignore => [/^TYPOGRAPHY_FOLDER/]

on build. The problem I’ve run into is that middleman throws a sass error on the files in that folder for being non compliant.

If anyone has worked this out I’d love to see the solution. Thanks!

Right now I’m guessing I’m going to jump back into typekit and Proxima Nova.