Closed MickL closed 7 years ago
@MickL This question is not gulp-twig.js related. You can use gulp.src('./template/**/[^_]*.twig')
and prefix your partials with underscore. However, I prefer to have then in a separate folder.
Hm but the problem is browserSync does not refresh with the [^_]
"hack". Partial support would be nice.
@davidhellmann I don't see the problem? You ignore all _
prefixed templates for rendering. browser-sync is a separate task in my setup, it runs parallel and watch all files changes.
@davidhellmann **/[^_]*.twig
isn't a hack, it's a glob that matches all files in ./template
(at any depth) that don't start with an underscore.
@MickL you can also exclude explicitly with something like gulp.src('yes1', 'yes2', '!no1, '!no2')
Check out Gulp for Beginners: Globbing in Node and isaacs' Glob Primer. You can test patterns with Glob online tester
I want to use twig.js for css-templating. My structure is something like:
html.twig header.twig footer.twig
mainpage.twig customers.twig contact.twig
The first 3 are only partials and i dont want them to get compiled which does
gulp.src('./template/**/*.twig')
. Is there any easy way to do this? Ofcourse i could put them into a seperate folder. But for example on sass if you name a file with a "_" prefix they wont get compiled. (e.g. _html.twig).