
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
gulp-repeat-item
Advanced tools
gulp 插件,循环输出item,适用于开发过程中一个商品组件要多次复制的情况,使代码更加美观更容易维护
npm install gulp-repeat-item --save-dev
gulpfile.js:
var gulp = require('gulp');
gulpRepeatItem = require('gulp-repeat-item');
gulp.task('default', function () {
return gulp.src('./*.html')
.pipe(gulpRepeatItem())
.pipe(gulp.dest('./build/'));
});
html:
<!--@@repeatItem(2) start-->
<div class="cube @@data{['eat1','bea','wine','game']}">
<div class="word">
<div class="img-w">
<div class="img"><img src="@@data{['img/text-eat@3x.png','img/text-beautify@3x.png','img/text-drink@3x.png','img/text-game@3x.png']}" alt=""></div>
<div class="w">food le parc</div>
</div>
<div class="t"><p>@@dataRandom{['(Monday)','(Tuesday)','(Wednesday)','(Thursday)','(Friday)','(Saturday)','(Sunday)']}</p></div>
<div class="w2">Summer @@dataRandom{['Chill','Parent']} Out Busking</div>
</div>
</div>
<!--@@repeatItem end-->
结果:
<div class="cube eat1">
<div class="word">
<div class="img-w">
<div class="img"><img src="img/text-eat@3x.png" alt=""></div>
<div class="w">food le parc</div>
</div>
<div class="t"><p>(Wednesday)</p></div>
<div class="w2">Summer Parent Out Busking</div>
</div>
</div>
<div class="cube bea">
<div class="word">
<div class="img-w">
<div class="img"><img src="img/text-beautify@3x.png" alt=""></div>
<div class="w">food le parc</div>
</div>
<div class="t"><p>(Thursday)</p></div>
<div class="w2">Summer Parent Out Busking</div>
</div>
</div>
.pipe(gulpHtmlVersion({
}))
参数列表
@@repeatItem(2) 数字2为要循环的个数@@data{[]} 按顺序显示数组内的元素@@dataRandom{[]} 随机显示数组内的元素FAQs
Gulp plugin to append version from package.json
We found that gulp-repeat-item 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.