var elements = document.getElementsByClassName('my-class');
Array.prototype.forEach.call(elements, function(element) {
emement.addEventListener('click', function(e) { /* ... */ });
});
var elements = document.getElementsByClassName('my-class');
for (var i = 0; i < emements.length; i++) {
elements[i].addEventListener('click', function(e) { /* ... */ });
}
const elements = document.getElementsByClassName('my-class');
for (let element of elements) {
emement.addEventListener('click', e => { /* ... */ });
}
gulp.task('scripts', function() {
return gulp.src([
'src/assets/libs/jquery/dist/jquery.min.js',
'src/assets/libs/jquery_lazyload/jquery.lazyload.js',
'src/assets/libs/slick-carousel/slick/slick.min.js',
'src/assets/js/script.js'
]).
on('error', notify.onError()).
pipe(cached('scripts')).
pipe(concat('index.min.js')).
pipe(uglify()).
pipe(gulp.dest('dist/assets/js')).
pipe(browserSync.reload({stream: true}));
});
gulp.task('version', function(){
return gulp.src(['src/**/*.html','src/**/*.php']) // Добавлен return
.pipe(replace('{{version}}', Date.now() ))
.pipe(gulp.dest('dist/'));
});