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

298
Vistas
Evaluate ruby code inside html :css filter

I want to add some css style that I calculate in my ruby code within a haml template.

I understand that I should use the :css filter to add a style tag for my css like this:

%head
  - my_color = "#0000ff"
  :css
    .my-class { 
      / how can I set my_color here:
      background-color: red; 
    }

But how can I use my_color inside the filter?

Edit: To be clear, I am looking for a <style> tag, not inline css on an element.

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

You can interpolate the variable with #{my_color}:

- my_color = "#0000ff"
:css
 .my-class {
   background-color: #{my_color};
 }
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