Allow you to parse a list of files and replace tokens based on specifics patterns. Inspired by alanshaw / grunt-include-replace.
This plugin requires Grunt
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-pattern-replace --save-dev
The task allow you to specify a list of tokens (a multi level dictionary), which allow you to replace in several files placeholder "variable". Your placeholder variables can be prefixed and suffixed, by example : [[alpha]]. You can use a dot separated variable, it allow you to group your keys logically : [[alpha.beta]] will match with the child key beta of the object alpha.
At the moment, only single file examples are provided. More tests will come soon.
In your project's Gruntfile, add a section named
patternReplace to the data object passed into
A list of tokens available for replacement in all files.
Variable/include directive prefix.
Variable/include directive suffix.
Default value: Relative to including file
Directory where includes will be resolved.
Default prefix and suffix are
It allows you to define placeholder variables like
In this example,
[[falcon]] would be replaced by
Same example while replacing default prefix and suffix.
Placeholder variables would be now
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.