Answer the question
In order to leave comments, you need to log in
How to compile only those files that are used in a gulp project?
I have a prompt folder, which contains all the plugins and libraries for any occasion.
This folder is compiled into dist.
Question: how to compile only those plugins or libraries that are used at a particular moment in a gulp project?
I use minification for this folder, and so far this code has been written:
gulp.task('prompt', function () {
return gulp.src('prompt/**/*.js')
.pipe(uglifyEs())
.pipe(gulp.dest('dist/prompt')),
gulp.src('prompt/**/*.css')
.pipe(csso())
.pipe(gulp.dest('dist/prompt')),
gulp.src(['prompt/**/*.*', '!prompt/**/*.css', '!prompt/**/*.js'])
.pipe(gulp.dest('dist/prompt'));
});
Answer the question
In order to leave comments, you need to log in
for any occasion.
npm install jquery
import $ from 'jquery';
$('.selector');
gulp.task('js', function () {
return gulp.src('src/app.js')
.pipe(babel())
.pipe(terser()) // uglify устарел давно
.pipe(gulp.dest('dist/js')),
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question