Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

270
Visualizações
Enabling asset pipeline for videos in middleman

In my middleman static site, my images, fonts and CSS are properly going through the asset pipeline, and getting their fingerprint suffix (img/logo-3e4a3149.png for example).

However, my mp4 files that reside in the assets/vid folder are just copied as is with the same name, which makes them stale (cache wise) when built and deployed.

How can additional asset types (mp4) be configured to be treated like images in this regard?

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

The file extension '.mp4' is not considered as asset files by default, i.e. are not listed in asset_extensions. Adding the file extension to the list fixes the issue (as you already figured out yourself).
Options to do so:

config[:asset_extensions] += %w[.mp4]

# or

config.asset_extensions += %w[.mp4]

# or

activate :asset_hash do |asset_hash|
  asset_hash.exts += %w[.mp4]
end

# or

# Passing `ext:` argument overrides list of file extensions!
activate :asset_hash, exts: %w[.css .png .jpg .jpeg .webp .svg .svgz .js .gif .ttf .otf .woff .woff2 .eot .ico .map .mp4]
over 4 years ago · Santiago Trujillo Relatório

0

Well, answering my own question, although I am not sure this is the approach intended by the developers.

  1. Found the source code for the AssetHash extension, which provides some insight.
  2. Found what seems to be an outdated configuration documentation that happens to mention the asset_hash setting (although the mentioned syntax does not work).

So after fiddling with it, I came up with this in my config.rb

activate :asset_hash # this was always there
config.asset_extensions << ".mp4"

It seems a little dirty, since all other settings in the middleman config are elegantly set using the set :something DSL, but at least it works.

I also noticed that this syntax works:

activate :asset_hash, exts: [".mp4"]

but it replaces the factory settings.

If someone finds a better option, please share.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda