-
Notifications
You must be signed in to change notification settings - Fork 32
Closed
Description
Hi,
This is related to #50 because i found the root cause of the problem.
This plugin does not return valid json by creating a circular reference to the file in it's data.
If i console.log(JSON.stringify(data)); i get:
TypeError: Converting circular structure to JSON
at JSON.stringify (<anonymous>)
at modifyContents (/Users/mrleblanc/GitHub/project-starter/node_modules/gulp-twig/index.js:40:20)
at wrappedMapper (/Users/mrleblanc/GitHub/project-starter/node_modules/map-stream/index.js:84:19)
at Stream.stream.write (/Users/mrleblanc/GitHub/project-starter/node_modules/map-stream/index.js:96:21)
at DestroyableTransform.ondata (/Users/mrleblanc/GitHub/project-starter/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:619:20)
at emitOne (events.js:115:13)
at DestroyableTransform.emit (events.js:210:7)
at addChunk (/Users/mrleblanc/GitHub/project-starter/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:291:12)
at readableAddChunk (/Users/mrleblanc/GitHub/project-starter/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:278:11)
at DestroyableTransform.Readable.push (/Users/mrleblanc/GitHub/project-starter/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js:245:10)
This is because of the _file and _target data which are added.
Here's the original data intended to be passed to twig:
{
"Webpack":"4",
"Gulp":"4",
"description":"Gulp project",
"title":"Gulp",
"test":"test variable"
}Here's the data twig receive after gulp-twig:
{
"Webpack": "4",
"Gulp": "4",
"description": "Gulp project",
"title": "Gulp",
"test": "test variable",
"_file": < File "index.twig" < Buffer 0 a 7 b 25 20 65 78 74 65 6e 64 73 20 27 2e 2e 2 f 62 61 73 65 2e 74 77 69 67 27 20 25 7 d 0 a 0 a 7 b 25 20 62 6 c 6 f 63 6 b 20 63 6 f 6e 74 65 6e 74 20 25 7 d... >> ,
"_target": {
path: '/Users/mrleblanc/GitHub/project-starter/src/templates/views/index.html',
relative: 'index.html'
}
}If someone could check and approve #51
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels