Closed tremby closed 7 years ago
Working around it using gulp-rename
for now.
Yeah, it would be possible to create an option that defaults to '.html' and can be overwritten. I'm cusrious what the usecase would be!
My use case was using twig to produce a file which was not HTML. Twig documentation itself says it's good to output any text-based language: http://twig.sensiolabs.org/doc/templates.html#synopsis
In this case I am using twig for HTML templates, but also needed a template for an icon font stylesheet, outputting stylus source code. It didn't make sense to add a dependency for another templating language just for this one part of the build process, so I chose to write the template in twig. But gulp-twig insisted on saving the output as .html
.
:+1: can i help? would it be accepted if i create a PR?
I think gulp-rename
is the correct solution. Gulp plugins are meant to be modular, and gulp-twig
is meant to be a wrapper for twig compilation. Duplicating gulp-rename
's functionality seems outside the scope of gulp-twig
, even if it does look similar to the renaming it's already doing (the current renaming is fundamental to the twig -> html compilation)
I disagree. A tool which renders Twig should not assume HTML is being written. As I pointed out before, the Twig documentation itself says the following:
A template is simply a text file. It can generate any text-based format (HTML, XML, CSV, LaTeX, etc.).
Allowing the user to specify the output filename would not be duplicating gulp-rename's functionality -- gulp-rename does a whole lot more.
Yes my comment was poorly worded in a couple ways. I'm wondering why not use gulp-rename?
I do, as mentioned in a previous comment. But I see it as a workaround which should not be necessary. gulp-twig should not be assuming I'm writing HTML.
Also disagree here. We're also got some undocumented option changeExt
to prevent the renaming. So why not just allow passing a value for extname
which defauts to '.html'.
Prepared a PR: https://github.com/zimmen/gulp-twig/pull/38
Ftr @tremby though I went dark in this thread you completely changed my mind. Now whenever it comes up I advocate for not assuming twig is being used for html. Glad you stood strong
I'm looking for an option to change the extension to some arbitrary string. I saw that there is a proposed option to leave the extension as it is on input over in #14, but this wouldn't do the trick for me.
Any chance of adding this?