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

Can path have multiple sources? #50

Closed jitendravyas closed 6 years ago

jitendravyas commented 7 years ago

I want to keep page specific partial in page directory

Instead path: 'src/templates' this path: 'src/templates', 'src/pages/**/partials'

is it possible? I tried that way but it's not working.

kamlekar commented 7 years ago

Try to pass as array.

['src/templates', 'src/pages/**/partials']
jitendravyas commented 7 years ago

I tried it but it's not working

  .pipe(nunjucksRender({
      path: ['src/templates', 'src/pages/**/**/includes']
    }))

error Error: template not found: component1.nunjucks

kamlekar commented 7 years ago

I think you meant like this:

.pipe(nunjucksRender({
      path: ['src/templates/**/*.nunjucks', 'src/pages/**/*.nunjucks']
}))

Here I am selecting all the files which has extension .nunjucks. If you are storing those nunjucks templates as html files, replace .nunjucks with .html.

jitendravyas commented 7 years ago

Array not working is a different problem but even after replacing this path: ['src/templates'] with this path: ['src/templates/*/.nunjucks'] has started giving error

jitendravyas commented 7 years ago

This is also not working path: ['src/templates', 'src/partials']

I have added more details in my question here http://stackoverflow.com/questions/39766802/array-of-multiple-path-is-not-working-in-nunjucks-for-templates-and-partials

zellwk commented 7 years ago

@jitendravyas ['src/templates'] with this path: ['src/templates/*/.nunjucks'] means you're looking for ONE file named .nunjucks. I believe you meant what @kamlekar mentioned. You might want to read up on globbing / put up a github repo so we can know what you're after. It's hard to debug without a seeing the file structure

kamlekar commented 7 years ago

@zellwk I think @jitendravyas already got the answer on SO. @jitendravyas please close this issue, if you already got the solution.