npmgulpgulp-babel

Gulp Module to read file content and use it in pipe


Usecase (abstract):

I have several files in which a certain value to be read. This value I want to use in the same pipeline again to read out a file and inject it.

Example HTML file source:

<html>
   <head>
     <link href="foo/bar/anyfilename.css">
   </head>
</html>

Example HTML file dest:

<html>
   <head>
     <style type="text/css">
       .example-class {
         color: red;
       }
     </style>
   </head>
</html>

I found various modules, but nothing suitable for my usecase.


Solution

  • Try gulp-replace if you really want to replace a string tag with some other content in your pipe.

    However, if you are trying to inject references you should look at gulp-inject.

    Tip: Try not to use inline styles if you can help it.