grunt-includes icon indicating copy to clipboard operation
grunt-includes copied to clipboard

Include in destination file between 2 tags

Open honkskillet opened this issue 10 years ago • 0 comments

Let's say we have a target .js file with the tags

 /* injector:tag */
     //Maybe, nor maybe not some content
   /* endinjector */

Is there a way to use regex to inject in between these tags. If there is already content between the tags, I would like to overwrite the content. I don't want the tags overwritten though.

I have tried

   includes:{
      myIncludes: {
        options: {
          includeRegexp: /\/* injector:tag *\/[\s\S]*?\/* endinjector *\//,
        },
        files: [{
          src: '.tmp/soundTree.json',
          dest: '<%= yeoman.client %>/treeTarget.js',
        }],
      },
    },

But the entire target file gets over written by the source file. Any thoughts

honkskillet avatar Feb 08 '16 14:02 honkskillet