Answer the question
In order to leave comments, you need to log in
How to add gsap to gulp?
Greetings.
Tell me how to add gsap and exactly scrolltrigger to gulp?
Here is my build
const gulp = require('gulp');
const browserSync = require('browser-sync').create();
const watch = require('gulp-watch');
const concatCss = require('gulp-concat-css');
const sass = require('gulp-sass')(require('sass'));
const autoprefixer = require('gulp-autoprefixer');
const sourcemap = require('gulp-sourcemaps')
const pug = require('gulp-pug')
const del = require('del')
gulp.task('pug', (callback) => {
return gulp.src('./src/pug/pages/**/*.pug')
.pipe(pug({
pretty: true
}))
.pipe(gulp.dest('./build/'))
.pipe(browserSync.stream())
callback()
})
gulp.task('scss', (callback) => {
return gulp.src('./src/scss/style.scss')
.pipe(sourcemap.init())
.pipe(sass())
.pipe(autoprefixer({
overrideBrowserslist: ['last 4 versions']
}))
.pipe(sourcemap.write())
.pipe(gulp.dest('./build/css/'))
.pipe(browserSync.stream())
callback()
});
gulp.task('cleanbuild', () => {
return del('./build')
})
gulp.task('copyimg', (callback) => {
return gulp.src('./src/img/**/*.*')
.pipe(gulp.dest('./build/img/'))
callback()
})
gulp.task('copyjs', (callback) => {
return gulp.src('./src/js/**/*.*')
.pipe(gulp.dest('./build/js/'))
callback()
})
gulp.task('copyfonts', (callback) => {
return gulp.src('./src/fonts/**/*.*')
.pipe(gulp.dest('./build/fonts/'))
callback()
})
gulp.task('watch', () => {
watch(['./build/js/**/*.*', './build/img/**/*.*'], gulp.parallel(browserSync.reload))
watch(['./src/scss/**/*.scss'], gulp.parallel('scss'))
watch(['./src/pug/**/*.pug'], gulp.parallel('pug'))
watch(['./src/img/**/*.*'], gulp.parallel('copyimg'))
watch(['./src/js/**/*.*'], gulp.parallel('copyjs'))
});
gulp.task('server', () => {
browserSync.init({
server: {
baseDir: "./build/"
}
});
});
gulp.task('default',
gulp.series(
gulp.parallel('cleanbuild'),
gulp.parallel('scss', 'pug', 'copyimg', 'copyjs','copyfonts'),
gulp.parallel('server', 'watch')
)
);
import {gsap} from "gsap"
import {ScrollTrigger} from "gsap/ScrollTrigger.min.js"
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question