Search code examples
yeomanyeoman-generatoryeoman-generator-angular

Yeoman placeholder in javascript files


How can I use a placeholder in Yeoman for a js file ? i tried to add it

  writing: function () {
    this.fs.copy(
      this.templatePath('portanova_template'),
      this.destinationPath(this.projectName)

    );
    if(this.answer) {
      this.fs.copy(
      this.templatePath('externalTemplate'),
        this.destinationPath(this.projectName+'/app'),
       {
        title: this.projectName
      }
      );
    }
  },

and in the js File just added

"<%= title %>"

wherever needed. But it doesn't seems to work.. Any ideas ?


Solution

  • You need to use this.fs.copyTpl() otherwise the template tags are not processed.