Pular para o conteúdoPágina inicial do Tinify
Entrar no Tinify

Vamos enviar um link por e-mail para você entrar na hora!

Primeira vez no Tinify?

Você pode criar uma conta gratuitamente

Criar conta

Instructions for Express

Define a helper function

Express allows you to output whatever HTML you wish. Here is an example how you can create a helper function to serve and optimize your static files via Tinify CDN.

const app = express();

app.locals.assetUrl = function(path) {
  return "https://xxxxxxxx.tinifycdn.com/" + path;
}

In all your templates, such as in this Pug example, call the helper function to generate an asset URL.

html
  head
    script(src=assetUrl('/scripts/site.js'))
    link(href=assetUrl('/styles/site.css') rel="stylesheet")
  body
    img(src=assetUrl('/images/header.jpg'))