Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
gulp-token-replace
Advanced tools
A token replace plugin for gulp 3
First, install gulp-token-replace
as a development dependency:
npm install --save-dev gulp-token-replace
Add it to your gulpfile.js
:
var replace = require('gulp-token-replace');
gulp.task('token-replace', function(){
var config = require('./configuration/config.json');
return gulp.src(['src/*.js', 'src/*.html'])
.pipe(replace({global:config}))
.pipe(gulp.dest('dist/'))
});
module.exports = {
"tokens":{
"RMLibs":"http://ads.pictela.com/ads/jsapi/ADTECH.js",
"size":"320x50",
"Copyrights":"Copyright 2010-2014 AOL Platforms.",
"Author":"Martin Wojtala"
},
"main":{
"name":"example",
"title":"EXAMPLE TITLE"
}
};
In a file (also works for JavaScript)
<!--{{tokens.Copyrights}}-->
<!--canvasSize:{{tokens.size}}-->
<!DOCTYPE html>
<html lang="en">
<head><title>{{main.title}}</title>
<meta http-equiv="X-UA-Compatible" content="IE=9">
<meta charset="UTF-8">
<script src="{{tokens.RMLibs}}"></script>
<script src="swipe.min.js"></script>
<link rel="stylesheet" href="{{main.name}}.css">
<script src="{{main.name}}.debug.js"></script>
</head>
<body>
<div id="content"></div>
<div id="debug"></div>
</body>
</html>
gulp-token-replace can be called with a config object with these attributes:
{{main.css}}
or {{styles/main.css}}
can be used.Type: Object
configuration object.
Note: gulp-token-replace cannot perform regex replacement on streams.
FAQs
A token replace plugin for gulp
We found that gulp-token-replace demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.