Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

263
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda