Answer the question
In order to leave comments, you need to log in
How to build a plugin only from the required modules?
Hello guys!
Please explain to the dumb one...
I have a project that I build using gulp. I set everything up according to the article: https://habr.com/ru/post/484714/
Everything works fine.
But here I decided to use the plugin https://swiperjs.com/get-started/
in the js project
And as I understand it, this plugin consists of a core and many other modules that I don’t need in the code.
The question is, how can I assemble the plugin in the required configuration and connect it to the project?
JS is built like this:
const gulp = require('gulp');
const concat = require('gulp-concat');
const babel = require('gulp-babel');
const terser = require('gulp-terser');
const rename = require('gulp-rename');
const sourcemaps = require('gulp-sourcemaps');
module.exports = function script(cb) {
return gulp.src([
'node_modules/jquery/dist/jquery.min.js',
'src/scripts/keengo.moreNav.js',
'src/scripts/autocomplete.js',
'src/scripts/perfectscroll.js',
'src/scripts/scripts.js'
])
.pipe(sourcemaps.init())
.pipe(babel({
presets: ['@babel/env']
}))
.pipe(concat('scripts.js')) // Конкатенируем в один файл
.pipe(terser())
.pipe(sourcemaps.write())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('build/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