pax_global_header 0000666 0000000 0000000 00000000064 14044033523 0014510 g ustar 00root root 0000000 0000000 52 comment=fb1df5d0e267b48cb7ba8cf25f784989dd7e63a3
grunt-replace-2.0.2/ 0000775 0000000 0000000 00000000000 14044033523 0014261 5 ustar 00root root 0000000 0000000 grunt-replace-2.0.2/.editorconfig 0000664 0000000 0000000 00000000223 14044033523 0016733 0 ustar 00root root 0000000 0000000 root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
grunt-replace-2.0.2/.gitattributes 0000664 0000000 0000000 00000000023 14044033523 0017147 0 ustar 00root root 0000000 0000000 * text=auto eol=lf
grunt-replace-2.0.2/.github/ 0000775 0000000 0000000 00000000000 14044033523 0015621 5 ustar 00root root 0000000 0000000 grunt-replace-2.0.2/.github/workflows/ 0000775 0000000 0000000 00000000000 14044033523 0017656 5 ustar 00root root 0000000 0000000 grunt-replace-2.0.2/.github/workflows/main.yml 0000664 0000000 0000000 00000000664 14044033523 0021333 0 ustar 00root root 0000000 0000000 name: CI
on:
- push
- pull_request
jobs:
test:
name: Node.js ${{ matrix.node-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version:
- 14
- 12
- 10
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test
grunt-replace-2.0.2/.gitignore 0000664 0000000 0000000 00000000027 14044033523 0016250 0 ustar 00root root 0000000 0000000 node_modules
yarn.lock
grunt-replace-2.0.2/.npmrc 0000664 0000000 0000000 00000000023 14044033523 0015374 0 ustar 00root root 0000000 0000000 package-lock=false
grunt-replace-2.0.2/CHANGELOG.md 0000664 0000000 0000000 00000000541 14044033523 0016072 0 ustar 00root root 0000000 0000000 ## [2.0.2](https://github.com/outaTiME/grunt-replace/compare/2.0.1...2.0.2) (2021-05-03)
### Bug Fixes
* upgrade lodash version to 4.17.21 regarding CWE-78 ([a5f3785](https://github.com/outaTiME/grunt-replace/commit/a5f3785aebfcc8b9b3835c68144e284313651d6a))
## [2.0.2](https://github.com/outaTiME/grunt-replace/compare/2.0.1...2.0.2) (2021-05-03)
grunt-replace-2.0.2/README.md 0000664 0000000 0000000 00000016776 14044033523 0015561 0 ustar 00root root 0000000 0000000 # grunt-replace
[](https://travis-ci.org/outaTiME/grunt-replace)
[](https://www.npmjs.com/package/grunt-replace)

[](#)
[](https://twitter.com/outa7iME)
> Replace text patterns with [applause](https://github.com/outaTiME/applause).
## Install
From NPM:
```shell
npm install grunt-replace --save-dev
```
## Usage
Assuming installation via NPM, you can use `grunt-replace` in your gruntfile like this:
```javascript
module.exports = function (grunt) {
grunt.initConfig({
replace: {
dist: {
options: {
patterns: [
{
match: 'foo',
replacement: 'bar'
}
]
},
files: [
{
expand: true, flatten: true, src: ['src/index.html'], dest: 'build/'
}
]
}
}
});
grunt.loadNpmTasks('grunt-replace');
grunt.registerTask('default', ['replace']);
};
```
## Options
Supports all the applause [options](https://github.com/outaTiME/applause#options) in addition to the ones below.
### excludeBuiltins
Type: `Boolean`
Default: `false`
If set to `true`, the built-in matching rules are excluded.
### force
Type: `Boolean`
Default: `true`
Force the copy of files even when those files don't have any match found for replacement.
### noProcess
Type: `String`
This option is an advanced way to control which file contents are processed.
> `processContentExclude` has been renamed to `noProcess` and the option name will be removed in the future.
### encoding
Type: `String`
Default: `grunt.file.defaultEncoding`
The file encoding to copy files with.
### mode
Type: `Boolean` or `Number`
Default: `false`
Whether to copy or set the existing file permissions. Set to `true` to copy the existing file permissions. Or set to the mode, i.e.: `0644`, that copied files will be set to.
### timestamp
Type: `Boolean`
Default: `false`
Whether to preserve the timestamp attributes (atime and mtime) when copying files. Set to true to preserve files timestamp. But timestamp will not be preserved when the file contents or name are changed during copying.
### silent
Type: `Boolean`
Default: `false`
If set to `true`, removes the output from stdout.
### pedantic
Type: `Boolean`
Default: `false`
If set to `true`, the task will fail with a `grunt.fail.warn` when no matches are present.
## Built-in replacements
Few matching rules are provided by default and can be used anytime (these will be affected by the `options` given):
* `__SOURCE_FILE__`:
Replace match with the source file.
* `__SOURCE_PATH__`:
Replace match with the path of source file.
* `__SOURCE_FILENAME__`:
Replace match with the filename of source file.
* `__TARGET_FILE__`:
Replace match with the target file.
* `__TARGET_PATH__`:
Replace match with the path of target file.
* `__TARGET_FILENAME__`:
Replace match with the filename of target file.
> If you are looking how to use an `built-in` replacements, check out the [How to insert filename in target](#how-to-insert-filename-in-target) usage.
## Examples
### Basic
File `src/manifest.appcache`:
```
CACHE MANIFEST
# @@timestamp
CACHE:
favicon.ico
index.html
NETWORK:
*
```
Task configuration on gruntfile:
```javascript
{
options: {
patterns: [
{
match: 'timestamp',
replacement: '<%= Date.now() %>'
}
]
},
files: [
{
expand: true, flatten: true, src: ['src/manifest.appcache'], dest: 'build/'
}
]
}
```
### Multiple matching
File `src/manifest.appcache`:
```
CACHE MANIFEST
# @@timestamp
CACHE:
favicon.ico
index.html
NETWORK:
*
```
File `src/humans.txt`:
```
__ _
_ _/__ /./|,//_`
/_//_// /_|/// //_, outaTiME v.@@version
/* TEAM */
Web Developer / Graphic Designer: Ariel Oscar Falduto
Site: https://www.outa.im
Twitter: @outa7iME
Contact: afalduto at gmail dot com
From: Buenos Aires, Argentina
/* SITE */
Last update: @@timestamp
Standards: HTML5, CSS3, robotstxt.org, humanstxt.org
Components: H5BP, Modernizr, jQuery, Bootstrap, LESS, Jade, Grunt
Software: Sublime Text, Photoshop, LiveReload
```
Task configuration on gruntfile:
```javascript
{
options: {
patterns: [
{
match: 'version',
replacement: '<%= pkg.version %>'
},
{
match: 'timestamp',
replacement: '<%= Date.now() %>'
}
]
},
files: [
{
expand: true, flatten: true, src: ['src/manifest.appcache', 'src/humans.txt'], dest: 'build/'
}
]
}
```
### Cache busting
File `src/index.html`:
```html