Installations
npm install broccoli-replace
Releases
Unable to fetch releases
Developer
outaTiME
Developer Guide
Module System
Unable to determine the module system for this package.
Min. Node Version
>=10
Typescript Support
No
Node Version
12.21.0
NPM Version
6.14.11
Statistics
16 Stars
60 Commits
8 Forks
4 Watching
2 Branches
4 Contributors
Updated on 04 May 2021
Bundle Size
176.98 kB
Minified
54.83 kB
Minified + Gzipped
Languages
JavaScript (90.76%)
Shell (9.24%)
Total Downloads
Cumulative downloads
Total Downloads
6,692,429
Last day
-11.9%
1,294
Compared to previous day
Last week
10.8%
7,644
Compared to previous week
Last month
-1.4%
34,086
Compared to previous month
Last year
-23.3%
499,553
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
3
broccoli-replace
Replace text patterns with applause.
Install
From NPM:
1npm install broccoli-replace --save-dev
Usage
Assuming installation via NPM, you can use broccoli-replace
in your Brocfile.js like this:
1var BroccoliReplace = require('broccoli-replace'); 2 3module.exports = new BroccoliReplace('src', { 4 files: [ 5 '**/*.html' 6 ], 7 patterns: [ 8 { 9 match: 'foo', 10 replacement: 'bar' 11 } 12 ] 13});
Options
Supports all the applause options.
Examples
Basic
File src/manifest.appcache
:
CACHE MANIFEST
# @@timestamp
CACHE:
favicon.ico
index.html
NETWORK:
*
Brocfile.js:
1var BroccoliReplace = require('broccoli-replace'); 2 3module.exports = new BroccoliReplace('src', { 4 files: [ 5 'manifest.appcache' 6 ], 7 patterns: [ 8 { 9 match: 'timestamp', 10 replacement: Date.now() 11 } 12 ] 13});
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
Brocfile.js:
1var BroccoliReplace = require('broccoli-replace'); 2var pkg = require('./package.json'); 3 4module.exports = new BroccoliReplace('src', { 5 files: [ 6 'manifest.appcache', 7 'humans.txt' 8 ], 9 patterns: [ 10 { 11 match: 'version', 12 replacement: pkg.version 13 }, 14 { 15 match: 'timestamp', 16 replacement: Date.now() 17 } 18 ] 19});
Cache busting
File src/index.html
:
1<head> 2 <link rel="stylesheet" href="/css/style.css?rel=@@timestamp"> 3 <script src="/js/app.js?rel=@@timestamp"></script> 4</head>
Brocfile.js:
1var BroccoliReplace = require('broccoli-replace'); 2 3module.exports = new BroccoliReplace('src', { 4 files: [ 5 'index.html' 6 ], 7 patterns: [ 8 { 9 match: 'timestamp', 10 replacement: Date.now() 11 } 12 ] 13});
Include file
File src/index.html
:
1<body> 2 @@include 3</body>
Brocfile.js:
1var BroccoliReplace = require('broccoli-replace'); 2var fs = require('fs'); 3 4module.exports = new BroccoliReplace('src', { 5 files: [ 6 'index.html' 7 ], 8 patterns: [ 9 { 10 match: 'include', 11 replacement: fs.readFileSync('./includes/content.html', 'utf8') 12 } 13 ] 14});
Regular expression
File src/username.txt
:
John Smith
Brocfile.js:
1var BroccoliReplace = require('broccoli-replace'); 2 3module.exports = new BroccoliReplace('src', { 4 files: [ 5 'username.txt' 6 ], 7 patterns: [ 8 { 9 match: /(\w+)\s(\w+)/, 10 replacement: '$2, $1' // Replaces "John Smith" with "Smith, John" 11 } 12 ] 13});
Lookup for foo
instead of @@foo
Brocfile.js:
1var BroccoliMergeTrees = require('broccoli-merge-trees'); 2var BroccoliReplace = require('broccoli-replace'); 3 4var inputNodes = [ 5 new BroccoliReplace('src', { 6 files: [ 7 'foo.txt' 8 ], 9 patterns: [ 10 { 11 match: /foo/g, // Explicitly using a regexp 12 replacement: 'bar' 13 } 14 ] 15 }), 16 new BroccoliReplace('src', { 17 files: [ 18 'foo.txt' 19 ], 20 patterns: [ 21 { 22 match: 'foo', 23 replacement: 'bar' 24 } 25 ], 26 usePrefix: false // Using the option provided 27 }), 28 new BroccoliReplace('src', { 29 files: [ 30 'foo.txt' 31 ], 32 patterns: [ 33 { 34 match: 'foo', 35 replacement: 'bar' 36 } 37 ], 38 prefix: '' // Removing the prefix manually 39 }) 40]; 41 42module.exports = new BroccoliMergeTrees(nodes);
Related
- applause - Human-friendly replacements
License
MIT © outaTiME
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: license:0
- Info: FSF or OSI recognized license: MIT License: license:0
Reason
Found 2/26 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/main.yml:1
- Info: no jobLevel write permissions found
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/outaTiME/broccoli-replace/main.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/main.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/outaTiME/broccoli-replace/main.yml/master?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/main.yml:22
- Info: 0 out of 2 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 npmCommand dependencies pinned
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 6 are checked with a SAST tool
Score
3.4
/10
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More