Search code examples
jenkinsyeomanyeoman-generator

How to pass data to a non html template with yeoman generator


I want to pass the name of my project into a number of different files, none of which are html files.

Is it possible to do something like the example below for non html files?

writing: function() {
   // takes two arguments: sourcePath, destPath
   this.fs.copy('_someTpl', 'Jenkinsfile', {data: this.tplData});
}

Or is there a way to write the data to an html file and read the content of the html file within a Jenkinsfile? Thanks in advance!


Solution

  • Yeoman doesn't care what kind of file you're copying. For Yeoman, it's only text files.

    I think your issue is using copy instead of copyTpl. Only copyTpl will inject the data in the template.