simon-dt / gulp-twig

Twig plugin for gulp.js, The streaming build system. Looking for maintainer or collaborators. See wiki
https://github.com/zimmen/gulp-twig/wiki/Looking-for-maintainer-or-collaborator(s)
MIT License
62 stars 33 forks source link

data variable reference bug #44

Closed icai closed 6 years ago

icai commented 6 years ago

https://github.com/zimmen/gulp-twig/blob/004763d9b581be9b6e13290a37622a891c9a1b80/index.js#L16

gulp.src(['./views/**/*.html'])
.pipe(twig({
            base: './views/',
            data: { tilte: 'sss'} // data
        }))

if I use the variable in one template, like this

{% set title = 'register' %}

ALL Template would be has data.title while equal to 'register'

https://www.npmjs.com/package/map-stream

change to

var data = file.data || Object.assign({}, options.data) || {};
vastolf commented 6 years ago

The fix for this in #45 is working, please take a look @zimmen

bezoerb commented 6 years ago

https://github.com/zimmen/gulp-twig/releases/tag/v1.2.0