mimosa-replace v1.3.9
mimosa-replace
DEPRECATED | This module and Mimosa itself are no longer maintained
Overview
This is a simple text replacement module for Mimosa.
For more information regarding Mimosa, see http://mimosa.io.
Usage
Add 'replace'
to your list of modules. That's all! Mimosa will install the module for you when you start up.
Functionality
For every key-value pair from the pairs
object, all occurrences of the key are replaced by the value. Pairs are processed one after another, this means that a pair can replace text replaced by an earlier pair, for instance:
Pair 1 - "%%NAME%%": "John %%SURNAME%%"
%%NAME%% => John %%SURNAME%%
Pair 2 - "%%SURNAME%%": "Smith"
John %%SURNAME%% => John Smith
Options
replace.step
string - optional
Workflow step to perform replacements on. Possible values are before
for beforeCompile
or after
for afterCompile
.
before
if not specified.
replace.extensions
array of strings - optional
The extensions of files to perform replacements on. All extensions if not specified.
replace.pairs
object
Key-value pairs for replacement. Value replaces its key.
replace.caseSensitive
boolean - optional
false
if not specified.
Example Config
fs = require('fs');
exports.config = {
...
replace: {
step: "before",
extensions: [
"html",
"php",
"css"
],
pairs: {
"%%DATE%%": new Date().toUTCString(),
"Old name": "New name",
"%%HEADER%%": fs.readFileSync('/path/to/header.html','utf8')
},
caseSensitive: true
}
...
}
Default Config
replace: {
step: "before",
caseSensitive: false
}
Changelog
3. 12. 2019 - 1.3.6 - updated readme
12. 7. 2018 - 1.3.5 - fixed issues link in package.json
12. 7. 2018 - 1.3.4 - updated and pinned dependencies
5. 6. 2018 - 1.3.3 - updated CI file
5. 6. 2018 - 1.3.2 - updated ignore files
5. 6. 2018 - 1.3.1 - moved to GitLab
21. 6. 2015 - 1.3.0 - added the ability to use functions as replacements
17. 3. 2015 - 1.2.2 - readme, .npmignore and package.json updates
9. 3. 2015 - 1.2.1 - fixed mimosa config
9. 3. 2015 - 1.2.0 - added binary check, code cleanup, readme update
3. 3. 2015 - 1.1.5 - fixed readme
3. 3. 2015 - 1.1.4 - more effective validation, updated package.json
3. 3. 2015 - 1.1.1-1.1.3 - fixed readme
3. 3. 2015 - 1.1.0 - added configurable workflow step, case sensitivity setting, fixed bugs
3. 3. 2015 - 1.0.1 - fixed license in package.json
3. 3. 2015 - 1.0.0 - first version
License
GPL v3
5 years ago
5 years ago
5 years ago
6 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago