alanshaw / grunt-include-replace

Grunt task to include files and replace variables. Allows for parameterised includes.
MIT License
200 stars 45 forks source link

Renaming Generated files #71

Closed kuzeko closed 8 years ago

kuzeko commented 8 years ago

Allow renames (suffix?) to generated files

possible expected behaviour


includereplace: {
      include: {
        options: {
          // Task-specific options go here.
          includesDir: './',
        },
        src:  ['*.html'],
        dest: 'app/',
        cwd:  'pages/',
        expand: true,
        rename: [{
               match: '.html',
               replacement: '-generated.html'
            }]
      }
    }

Will check for names containing the match pattern and rename them with the replacement string, as would do str.replace(match, replacement)

alanshaw commented 8 years ago

This is built into grunt: http://gruntjs.com/configuring-tasks#building-the-files-object-dynamically

Does that do what you need?

If not, I'd probably not add this to grunt-include-replace over simply using a grunt plugin to do it.

kuzeko commented 8 years ago

Sure, it almost cover my use cases, just I was looking for that renaming to happen only when the grunt-include-replace plugin actually found something to replace/rewrite.

Anyway, thanks for the pointer.