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

167
Vistas
How to use loop for in gulp?

I am trying to automate file creation in gulp. I made a prepare task that should take section names from an array and generate files with built-in markup inside:

function prepare(){
  for(let i = 0; i==sections.length-1;i++){
    return createFile(`src/parts/_${sections[i]}.html`, `
    <div class="${sections[i]}">
      <div class="${sections[i]}__content ${sections[i]}__container"></div>
    </div>\n`, 
    function (err) {
      // file either already exists or is now created (including non existing directories)
    });
  }
}

But this error comes out: enter image description here

It means the lack of return in the function. How to execute a for loop creating files and still use return?

about 4 years ago · Juan Pablo Isaza
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