-
-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object. #22
Comments
Do you have any empty files? Might be |
@kevva Thanks for responding! I don't have any empty files in |
Hi, same problem here. It throws: First argument must be a string, Buffer... if i use something wrong as a macro-parameter for example. Its ok to show an error-message here but if it throws the gulp-process with all watchers gets canceled so users have to manually restart it. I use plumber for catching those plugins but here it does not work :/ Is it possible to just not throw the errors? My code... .pipe(gulpNunjucks.compile({}, {
env: nunjucksEnv
}))
.pipe(plumber({ handleError: handleError })) Thank you. |
…er, Array, or array-like object. fixes sindresorhus#22
I'm getting this error when I try to use macros that are defined in a file that's included. As soon as I remove the macros, the error goes away. Error[00:14:11] Starting 'compHTML'...
[00:14:11] 'compHTML' errored after 152 ms
[00:14:11] TypeError in plugin "gulp-nunjucks"
Message:
First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.
Details:
fileName: /Users/nick/Development/**/cause.njk
domainEmitter: [object Object]
domain: [object Object]
domainThrown: false Nunjucks Config/**
* COMP_HTML
*
* Compile nunjucks into html
*/
const compHTML = () => {
htmlComped = true
return gulp
.src('src/**/*.njk')
.pipe($.data(config))
.pipe($.nunjucks.compile())
.pipe($.filter(['**', '!_*'])) // Remove files we don't want exported
.pipe(
$.rename(function (path) {
path.extname = '.html'
})
)
.pipe(gulp.dest('public'))
} Layout{% extends "./templates/_base.njk" %}
{% import "includes/mixins.njk" as mixins with context %}
{% import "includes/mxCause.njk" as mxCause with context %}
{% block main %}
{{ mxCause.circleStat('Education-circle-2', '5,390hrs', 'Volunteered') }}
{% endblock %} Include{% macro circleStat(imgName, number, stat) %}
<div>
<img class="width-6 height-6" src="/assets/img/circles/{{imgName}}.svg"/>
<h1 class="type-h mb-0 pb-0">{{number}}</h1>
<spam class="type-d">{{stat}}</span>
</div>
{% endmacro %} Let me know if there's any additional information I can provide, or some type of debug mode I can enable on the plugin. |
Hello! I'm trying to use
gulp-nunjucks
to compile Twig syntax in PatternLab Node Gulp edition.I keep getting the following error, and I'm not sure how to resolve it:
Here's the relevant part of my
gulpfile.js
:I understand that
compile
takes two arguments,data
andoptions
. It seems like I have two arguments there,{}
and myenv
option.My end goal is to get html files in my
public.templates
directory, so maybe there is a function I could use besidescompile
? I'm open. If I replacecompile
withprecompile
and remove the first argument,gulp nunjucks
completes with no errors, but it doesn't seem like it actually does anything.Please help me figure out what I'm missing! Thank you in advance. 🙇♀️
The text was updated successfully, but these errors were encountered: