Missed this and had to grab the code from some pull requests. Will do this maybe later by myself. I used this to replace a placeholder everytime it gets matched with another class name:
var wallpapers = [
'form',
'drops',
'circles',
'fire',
'flowers'
];
var wallpaperKey = 0;
subStream = subStream.pipe(plugins.replace('NEXTWALLPAPERCLASS', function ()
{
var currentWallpaper = wallpapers[wallpaperKey];
++wallpaperKey;
if (wallpaperKey >= wallpapers.length)
{
wallpaperKey = 0;
}
return 'wallpaper-' + currentWallpaper;
}));
So this will make:
<div class="NEXTWALLPAPERCLASS">Foo</div>
<div class="NEXTWALLPAPERCLASS">Foo</div>
<div class="NEXTWALLPAPERCLASS">Foo</div>
<div class="NEXTWALLPAPERCLASS">Foo</div>
<div class="NEXTWALLPAPERCLASS">Foo</div>
<div class="NEXTWALLPAPERCLASS">Foo</div>
To:
<div class="form">Foo</div>
<div class="drops">Foo</div>
<div class="circles">Foo</div>
<div class="fire">Foo</div>
<div class="flowers">Foo</div>