E
E
Egor Mordvinov2017-01-12 20:13:09
JavaScript
Egor Mordvinov, 2017-01-12 20:13:09

What is the correct way to use gulp-rigger for js files?

There is a bootstrap-sprockets.js file that contains the paths for connecting bootstrap files

//=require ./bootstrap/transition
//=require ./bootstrap/alert
//=require ./bootstrap/button
//=require ./bootstrap/carousel
//=require ./bootstrap/collapse
//=require ./bootstrap/dropdown
//=require ./bootstrap/modal
//=require ./bootstrap/tab
//=require ./bootstrap/affix
//=require ./bootstrap/scrollspy
//=require ./bootstrap/tooltip
//=require ./bootstrap/popover

The general structure of the project
6b33a809b83e46a2ac4da7769d119eb5.png
I do a task for gulp to collect it all into one file and connect it to index.html
gulp.task('rigger-bootstrap-jquery', function () {
    gulp.src(path.src.js + '/bootstrap-sprockets.js')
        .pipe(rigger()) 
        .pipe(gulp.dest(path.src.js + '/bootstrap-components.js')); 
});

I get an error
TypeError: First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.

Spaces before require were taken into account and removed. What could be wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex_proger, 2017-01-25
@PerpetuumMobileSuper

As far as I understood from my torment with riggerom during the build, this is that it perceives "//=" as a forced attempt to include the file, and if there is no path to the file after "//=", it simply exits and shows an error.
Try //= ../bootstrap/button, it will understand that, but you will have to edit the library sources.
Otherwise, I advise you to consider other options for processing JS files.
Also, rigger doesn't support recursive addition of files...
I only use it for inserting into HTML, some static HTML...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question