carlitoplatanito / gulp-nunjucks-render

[Gulp](https://github.com/wearefractal/gulp) plugin to render [Nunjucks](http://mozilla.github.io/nunjucks/) templates
149 stars 33 forks source link

Customizing Syntax #45

Closed pinin closed 6 years ago

pinin commented 8 years ago

Hi, Can you help me? how to set up the syntax changes

var render = require('gulp-nunjucks-render')

render.nunjucks.configure(config.nunjucks, { 
      watch: false ,
      tags: {
        variableStart: '<$',
        variableEnd: '$>'
      }
 })

This to does not work Thanks

ohenrik commented 8 years ago

Would be great if this was solved. @pinin did you figure it out? Or is it not supported yet?

ohenrik commented 8 years ago

Solved: Set the tags like so:

     envOptions: {
          tags: {
            blockStart: '{%',
            blockEnd: '%}',
            variableStart: '{$',
            variableEnd: '$}',
            commentStart: '{#',
            commentEnd: '#}'
          },
        }

Example:

      nunjucksRender({
        path: [config.src.path],
        envOptions: {
          tags: {
            blockStart: '{%',
            blockEnd: '%}',
            variableStart: '{$',
            variableEnd: '$}',
            commentStart: '{#',
            commentEnd: '#}'
          },
        }
      })

same goes for watch: false i think.