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

Get multiple directories with nunjucksRender #81

Closed blachawk closed 1 year ago

blachawk commented 1 year ago

I have the following setup with gulp-nunjucks-render : 2.2.3

function genNunJucks(cb) {
    return src(['src/views/*.html'])
        .pipe(nunjucksRender({
            path: ['src/views/',], // String or Array
            ext: '.html',
            data: {
                //mclass: 'mCustomClass',
            },
            inheritExtension: false,
            envOptions: {
                watch: true
            },
            manageEnv: manageEnvironment,
            loaders: null
        }))
        .pipe(htmlbeautify({
            indentSize: 2,
            "eol": "\n",
            "indent_level": 0,
            "preserve_newlines": false
        }))
        .pipe(dest('pub'))
    cb();
}

I have the following views structure in my project directory...

C:\MY-PROJECT\SRC\VIEWS
│   index.html
│   
├───parts
│   │   bottom_bar.html
│   │   top_bar.html
│   │   _footer.html
│   │   _head.html
│   │   _header.html
│   │   _scripts.html
│   │   
│   └───_arc
├───shopffa
│       index.html
│       
└───templates
    │   column1.html
    │   
    └───_arc

when I run gulp I can easily get the root index.html file into my pub directory. But how can I also bring over shopffa/index.html into my pub directory as well? Is there a feature for that I can enable?

blachawk commented 1 year ago

I was able to solve my issue by running nunjucksRender multiple times, on unique paths.