L
L
Lero622021-05-04 15:29:22
gulp.js
Lero62, 2021-05-04 15:29:22

How to avoid compressing the js file in gulp, but so that it is added to the js folder and included as a separate file?

How can I avoid compressing the main.js file in the gulp assembly, and so that it is included in the compressed layout. It should look like this all.js and main.js

Now my code looks like this

var path = {
  //папка куда складываются готовые файлы
    build: { 
        html: 'build/',
        js: 'build/js/',
        css: 'build/css/',
        img: 'build/img/',
        fonts: 'build/fonts/'
    },
    //папка откуда брать файлы
    src: { 
        html: 'src/*.html', 
        js: ['src/js/jquery-3.2.1.min.js', 'src/js/libs/*.js', '!src/js/main.js'],
        style: 'src/sass/*.sass', 
        css: 'src/css/*.css', 
        img: 'src/img/**/*.*', 
        fonts: 'src/fonts/**/*.*'
    },

};
function scripts(){
  return gulp.src(path.src.js) 
        .pipe(rigger()) 
        .pipe(sourcemaps.init())
        .pipe(concat('all.js'))
        .pipe(uglify()) 
        .pipe(gulp.dest(path.build.js))
        .pipe(browserSync.reload({stream: true}));
}


Finally familiar! I exclude the main.js file but then it doesn't get into the build folder =( how to solve this problem?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question