Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for destination to be a function #42

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ahmednuaman
Copy link

So I needed the ability to also change the filename of the replaced files, so I added the ability to specify destination as a function, for example:

replace: {
  all: {
    src: ['foo.json', 'bar/*.json'],
    dest: function (input) {
      return input + '.j2';
    },
    replacements: [{
      from: 'foo',
      to: 'bar'
    }]
  }
}

Hope that's cool :)

@leszekhanusz
Copy link

leszekhanusz commented Feb 28, 2018

Thanks for this pull request.
It is very useful for me for a quick and dirty templating mechanism.

This will replace the texts from files containing .template to the corresponding file without .template
For example It will replace the texts from foo.template.css to foo.css or blah.template.js to blah.js

src: ['app/assets/**/*.template.*'],
dest: function (input) {
  return input.replace('.template', '');
},
replacements: [{
      from: 'foo',
      to: 'bar'
}]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants