Search code examples
gulpgulp-rename

How to remove the suffix using gulp rename


I wish to copy some twig files while removing the 'src' suffix example: someCode.html.src.twig with the result : someCode.html.twig using gulp rename as I must have this change implemented for several files that all have the src suffix.

I also wish to maintain the directory structure:

example:

D: test --> formsDirectory --> someFile.html.src.twig , someotherFile.html.src.twig

    --> SomeOtherDir   --> onemore.html.src.twig

result: D: someDir --> formsDirectory --> someFile.html.twig , someotherFile.html.twig

       --> SomeOtherDir   --> onemore.html.twig

I know that I can use gulp rename to remove the extension and basename however I wish to only change the suffix are illustrated. Any Help would be Great! thanks


Solution

  • Use gulp-ext-replace

    Example:

    .pipe(ext_replace('twig', '.src.twig'))