Hello. It is necessary to alter one site, there smarty templates with tpl extension. Please tell gulp-jade how to set up gulp-jade so that it compiles *.jade templates into *.jade files, otherwise it only creates in *.html .

For some reason I did not find it anywhere, is there really no such setting?

  • 2
    Nope Otherwise, it would be a meta-template engine. - D-side
  • @ D-side, "no" does not have the word "no," and no one forbids us to save the compiled file in another extension. - Vadizar
  • one
    Give a small example of three files. jade, html and the desired tpl. Why are you here jade, it is not clear) - vp_arth

1 answer 1

To save the compiled file to a different format, use gulp-rename :

 var gulp = require('gulp'), pug = require('gulp-pug'), rename = require('gulp-rename'); // Compiling Pug in HTML gulp.task('views', function () { gulp.src('./views/*.pug') .pipe(pug()) .pipe(rename('index.tpl')) .pipe(gulp.dest('./public/')) }); 

Screen functions can be through | . Below is an example with the PHP function:

  h1 FAQ .summury details summary Some text p | <?php md_cache()?> 

The above code will compile to:

  <h1>FAQ</h1> <div class="summury"> <details> <summary>Some text</summary> <p><?php md_cache()?></p> <details> 

PS Jade renamed to Pug.

  • Delightfully, give an example of a parameterized pattern, say, an array of stitches that is rendered outside. What is at the entrance, what is at the exit and whether the functionality is preserved. - D-side
  • @ D-side your sarcasm is inappropriate here. The question was to save a certain extension. However, I added to the answer an example of working with the php function. - Vadizar
  • As soon as the author of the question would be satisfied with the "setting" of the extension, it is probably the name that he is looking for. - vp_arth
  • @Vadizar is also appropriate, since the task of converting Jade to Smarty, stated in the question, does not solve this problem in general. But now you have at least demonstrated what exactly is needed to apply your solution, so I’m taking a minus. - D-side
  • @D-side the author wanted to learn not how to insert smarty functions in Jade, but how to compile it in .tpl. Apparently, he knows how to use the functions of third-party languages ​​in this template engine. Although, this example may be useful to other participants. - Vadizar