kuzyk / gulp-rigger Goto Github PK
View Code? Open in Web Editor NEWJavascript file parser and include engine #buildjs #node http://buildjs.github.io/rigger
Javascript file parser and include engine #buildjs #node http://buildjs.github.io/rigger
When I write comments like / ========= / into file where I try to load another scripts (with using //= path/to/file.js) I catch the next error:
buffer.js:247
throw new TypeError(kFromErrorMsg);
^
TypeError: must start with number, buffer, array or string
at fromObject (buffer.js:247:9)
at Function.Buffer.from (buffer.js:115:10)
at new Buffer (buffer.js:94:17)
at /var/www/gateway-portal/node_modules/gulp-rigger/index.js:20:29
at Rigger.<anonymous> (/var/www/gateway-portal/node_modules/rigger/index.js:719:9)
at emitOne (events.js:90:13)
at Rigger.emit (events.js:182:7)
at /var/www/gateway-portal/node_modules/rigger/index.js:252:16
at /var/www/gateway-portal/node_modules/rigger/node_modules/async/lib/async.js:232:13
at /var/www/gateway-portal/node_modules/rigger/node_modules/async/lib/async.js:113:21
When I delete the comments I have a working code without any changes for another sides.
Crash happens when I include files with other extensions than the original.
//= part1.doc
//= part2.txt
I'd rather not have such restrictions. Is it possible?
I had a gulp 3 configuration with gulp-plumber as error handler (so current running task never crashes) and also had a gulp-notify as a message alert to system in a case for errors, for example if I made a mistake in the path of the file name, such as an empty space at the end, there was a handy notify. But i recently update my gulp to 4 version and here the problems started - gulp-plumber stopped working, current task doesn't fail in the 4th version of gulp (in case a space typo on the end of filepath), only alert in console, so plumber became unnecessarily thing in this configuration in my opinion, and unfortunately gulp-notify also stopped working.
//My old gulp 3 task:
gulp.task('htmlTemplate', function () {
return gulp.src(path.layout.htmlTemplate)
.pipe(plumber({errorHandler: notify.onError({
message: "Error: <%= error.message %>",
title: "HTML - ошибка компиляции"
})}))
.pipe(rigger())
.pipe(gulp.dest(path.layoutDest.html))
.pipe(reload({stream: true}));
});
//Current gulp 4, unfortunantely notifier and onerror doesn't work
gulp.task('htmlTemplate', function () {
return gulp.src(path.layout.htmlTemplate)
.pipe(rigger()
.on('error', notify.onError({
message: "Error: <%= error.message %>",
title: "HTML - ошибка компиляции"
})
))
.pipe(rigger())
.pipe(gulp.dest(path.layoutDest.html))
.pipe(reload({stream: true}));
});
Maybe someone have a working configuration in gulp 4?
Gulp-rigger doesnt work with gulp-plumber. Buffer.js:67 error appears.
var gulp = require('gulp'),
plumber = require('gulp-plumber'),
rigger = require('gulp-rigger');
var onError = function(err) {
notify.onError({message: "Failed\n<%= error.message %>", sound: true})(err);
this.emit('end');
}
gulp.task('javascript', function() {
gulp.src('src/js/*.js')
.pipe(plumber({errorHandler: onError}))
.pipe(rigger())
.pipe(gulp.dest('./js'))
.pipe(onComplete());
});
gulp.task('default', ['javascript']);
Возможно это из-за большого кол-ва файлов. Таск отрабатывает:
gulp.task('html', function () {
gulp.src('app/pages/*.html')
.pipe(rigger())
.pipe(gulp.dest('app/'))
.pipe(browsersync.reload( {stream: true} ))
});
вот консоль:
[20:06:02] Starting 'html'...
[20:06:02] Finished 'html' after 1.82 ms
Но файлы не выгружаются. Если поудалять все полностью и закинуть все заново в папку сборки, то страницы начинают собираться, но не все(
Прошу помочь! так как проект весьма крупный, и не хотелось бы сейчас переделывать во что-то другое
Add example of construction in sources
Is it possible to connect 2 css files into one using gulp-rigger? And how to do it?
I tried to do it:
My main.css:
/*
* Third party
*/
//= ../../bower_components/normalize.css/normalize.css
/*
* Custom
*/
//= partials/style.css
Task for gulp:
gulp.task('css:build', function () {
gulp.src(path.src.css)
.pipe(rigger())
.pipe(sourcemaps.init())
.pipe(cssmin())
.pipe(sourcemaps.write())
.pipe(gulp.dest(path.build.css))
.pipe(connect.reload());
});
But as a result I get:
//=../../bower_components/normalize.css/normalize.css //=partials/style.css
/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWFpbi5jc3MiLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIiwic291cmNlcyI6WyJtYWluLmNzcyJdLCJzb3VyY2VzQ29udGVudCI6WyIvKlxyXG4gKiBUaGlyZCBwYXJ0eVxyXG4gKi9cclxuLy89IC4uLy4uL2Jvd2VyX2NvbXBvbmVudHMvbm9ybWFsaXplLmNzcy9ub3JtYWxpemUuY3NzXHJcblxyXG5cclxuLypcclxuICogQ3VzdG9tXHJcbiAqL1xyXG4vLz0gcGFydGlhbHMvc3R5bGUuY3NzIl0sInNvdXJjZVJvb3QiOiIvc291cmNlLyJ9 */
Faced with a problem of RangeError: Maximum call stack size exceeded
. Took a look into the versions of dependent rigger version and it's:"gulp-rigger": "^0.5.8"
and i found it totally out of date as this version had been release 4 years ago. Of course i fixed this problem by installing last version of rigger, but i guess it would be nice to change the version of rigger for the last one in the dependencies list.
buffer.js:68
throw new TypeError('must start with number, buffer, array or string');
^
TypeError: must start with number, buffer, array or string
at new Buffer (buffer.js:68:11)
at D:\SERVER_U2\frontend\esterfurs\node_modules\gulp-rigger\index.js:23:29
at Rigger. (D:\SERVER_U2\frontend\esterfurs\node_modules\gulp-rigger\node_modules\rigger\index.js:719:9)
at Rigger.emit (events.js:107:17)
at D:\SERVER_U2\frontend\esterfurs\node_modules\gulp-rigger\node_modules\rigger\index.js:252:16
at D:\SERVER_U2\frontend\esterfurs\node_modules\gulp-rigger\node_modules\rigger\node_modules\async\lib\async.js:232:13
at D:\SERVER_U2\frontend\esterfurs\node_modules\gulp-rigger\node_modules\rigger\node_modules\async\lib\async.js:113:21
at D:\SERVER_U2\frontend\esterfurs\node_modules\gulp-rigger\node_modules\rigger\node_modules\async\lib\async.js:24:16
at D:\SERVER_U2\frontend\esterfurs\node_modules\gulp-rigger\node_modules\rigger\node_modules\async\lib\async.js:229:17
at D:\SERVER_U2\frontend\esterfurs\node_modules\gulp-rigger\node_modules\rigger\index.js:391:21
It is not clear what your plugin does without any documentation except of just obvious gulp
settings.
TypeError: Cannot read property 'toString' of null
at /Users/username/Code/project/node_modules/gulp-rigger/index.js:19:37
TypeError: First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.
at fromObject (buffer.js:262:9)
at Function.Buffer.from (buffer.js:101:10)
at new Buffer (buffer.js:80:17)
at C:\Users*\alinabolat.com\node_modules\gulp-rigger\index.js:20:29
at Rigger. (C:\Users*\alinabolat.com\node_modules\rigger\index.js:719:9)
at emitOne (events.js:96:13)
at Rigger.emit (events.js:188:7)
at C:\Users*\alinabolat.com\node_modules\rigger\index.js:252:16
at C:\Users*\alinabolat.com\node_modules\rigger\node_modules\async\lib\async.js:232:13
at C:\Users*\alinabolat.com\node_modules\rigger\node_modules\async\lib\async.js:113:21
I am getting this error which I don't understand. Please, could you help me with this error. Please see below the link to my code:
https://github.com/anuar-bolatov/alinabolat.com.git
Kindest regards,
Anuar
Hi!
Thanx for this great lib
I have some problems
Rigger should to normally works with recursive includes, but not for me
I have next file structures
/file.html
/folder1/file1.html
/folder/file2.html
in /file.html I wrote
//= folder1/file1.html
in folder1/file1.html I wrote
//= file2.html
and catch the problem
buffer.js:68
throw new TypeError('must start with number, buffer, array or string');
^
TypeError: must start with number, buffer, array or string
at new Buffer (buffer.js:68:11)
at /Users/itimohin/Documents/CLOUD_STORAGES/OneDrive/PHPStorm-Projects/template-frontend/node_modules/gulp-rigger/index.js:20:29
at Rigger.<anonymous> (/Users/itimohin/Documents/CLOUD_STORAGES/OneDrive/PHPStorm-Projects/template-frontend/node_modules/gulp-rigger/node_modules/rigger/index.js:719:9)
at Rigger.emit (events.js:107:17)
at /Users/itimohin/Documents/CLOUD_STORAGES/OneDrive/PHPStorm-Projects/template-frontend/node_modules/gulp-rigger/node_modules/rigger/index.js:252:16
at /Users/itimohin/Documents/CLOUD_STORAGES/OneDrive/PHPStorm-Projects/template-frontend/node_modules/gulp-rigger/node_modules/rigger/node_modules/async/lib/async.js:232:13
at /Users/itimohin/Documents/CLOUD_STORAGES/OneDrive/PHPStorm-Projects/template-frontend/node_modules/gulp-rigger/node_modules/rigger/node_modules/async/lib/async.js:113:21
at /Users/itimohin/Documents/CLOUD_STORAGES/OneDrive/PHPStorm-Projects/template-frontend/node_modules/gulp-rigger/node_modules/rigger/node_modules/async/lib/async.js:24:16
at /Users/itimohin/Documents/CLOUD_STORAGES/OneDrive/PHPStorm-Projects/template-frontend/node_modules/gulp-rigger/node_modules/rigger/node_modules/async/lib/async.js:229:17
at /Users/itimohin/Documents/CLOUD_STORAGES/OneDrive/PHPStorm-Projects/template-frontend/node_modules/gulp-rigger/node_modules/rigger/index.js:391:21
also I tried to write
//= ./file2.html
but result was just like this
Can you help me?
Thank you
buffer.js:68
throw new TypeError('must start with number, buffer, array or string');
^
TypeError: must start with number, buffer, array or string
at new Buffer (buffer.js:68:11)
at /home/user/testproject/node_modules/gulp-rigger/index.js:20:29
at Rigger. (/home/user/testproject/node_modules/gulp-rigger/node_modules/rigger/index.js:719:9)
at Rigger.emit (events.js:107:17)
at /home/user/testproject/node_modules/gulp-rigger/node_modules/rigger/index.js:252:16
at /home/user/testproject/node_modules/gulp-rigger/node_modules/rigger/node_modules/async/lib/async.js:232:13
at /home/user/testproject/node_modules/gulp-rigger/node_modules/rigger/node_modules/async/lib/async.js:113:21
at /home/user/testproject/node_modules/gulp-rigger/node_modules/rigger/node_modules/async/lib/async.js:24:16
at /home/user/testproject/node_modules/gulp-rigger/node_modules/rigger/node_modules/async/lib/async.js:229:17
at /home/user/testproject/node_modules/gulp-rigger/node_modules/rigger/index.js:391:21
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.