You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code below was the solution I implemented for my GitHub pages, it seems to work. However, I am not very experienced in gulp so I am not sure if it is the correct fix.
If anyone can see if I am on the right path I will gladly submit a PR.
vargulp=require('gulp');varsass=require('gulp-sass');varprefix=require('gulp-autoprefixer');varimagemin=require('gulp-imagemin');varpngquant=require('imagemin-pngquant');varcache=require('gulp-cache');varcp=require('child_process');varbrowserSync=require('browser-sync');varjekyll=process.platform==='win32' ? 'jekyll.bat' : 'jekyll';// Build the Jekyll Sitegulp.task('jekyll-build',function(done){returncp.spawn(jekyll,['build'],{stdio: 'inherit'}).on('close',done);});// Rebuild Jekyll and page reloadgulp.task('jekyll-rebuild',function(){browserSync.reload();});// Compile filesgulp.task('sass',function(){returngulp.src('assets/css/scss/main.scss').pipe(sass({outputStyle: 'expanded',onError: browserSync.notify})).pipe(prefix(['last 15 versions','> 1%','ie 8','ie 7'],{cascade: true})).pipe(gulp.dest('_site/assets/css')).pipe(browserSync.reload({stream:true})).pipe(gulp.dest('assets/css'));});// Compression imagesgulp.task('img',function(){returngulp.src('assets/img/**/*').pipe(cache(imagemin({interlaced: true,progressive: true,svgoPlugins: [{removeViewBox: false}],use: [pngquant()]}))).pipe(gulp.dest('_site/assets/img')).pipe(browserSync.reload({stream:true}));});// Wait for jekyll-build, then launch the Servergulp.task('browser-sync',gulp.series('sass','img','jekyll-build'),function(){browserSync({server: {baseDir: '_site'},notify: false});});// Watch scss, html, img filesgulp.task('watch',function(){gulp.watch('assets/css/scss/**/*.scss',gulp.series('sass'));gulp.watch('assets/js/**/*.js',gulp.series('jekyll-rebuild'));gulp.watch('assets/img/**/*',gulp.series('img'));gulp.watch(['*.html','_layouts/*.html','_includes/*.html','_pages/*.html','_posts/*'],gulp.series('jekyll-rebuild'));});// Default taskgulp.task('default',gulp.series('browser-sync','watch'));
The text was updated successfully, but these errors were encountered:
lucaskup
changed the title
Gulp V4
Gulpgile.js not working in Gulp V4. Gulp V3 to V4 update
May 7, 2021
The gulpfile.js uses gulp v3 syntax.
It should be updated to v4 syntax.
Basically, there are two changes needed as far as I can see:
Please see this stackoverflow post for details.
The code below was the solution I implemented for my GitHub pages, it seems to work. However, I am not very experienced in gulp so I am not sure if it is the correct fix.
If anyone can see if I am on the right path I will gladly submit a PR.
The text was updated successfully, but these errors were encountered: