Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Yeoman copy directory without templating

I am using yeoman for creating a scaffold for my app.

I want to copy all the directory recursively thats why I am using this.directory method

this.directory('views/static/views', '.views/static/views');

Now whenever I am running it shows an error showing <%= title %> in file index.html during copying is not defined.

This <%= title %> is not the part of Templating but I am using this for my other purpose.

I want to disable the templating while copying using this.directory method.?

like image 781
Robins Gupta Avatar asked Nov 26 '15 13:11

Robins Gupta


1 Answers

I figure it out. using this.fs.copy copies recursively without templating.

writing: function () {
    this.fs.copy(
      this.templatePath('views/static/views'),
      this.destinationPath('.views/static/views')
    );
  }

Now when templating the correct syntax should be

writing: function () {
    this.fs.copyTpl(
      this.templatePath('index.html'),
      this.destinationPath('public/index.html'),
      { title: 'Templating with Yeoman' }
    );
  }
like image 139
Robins Gupta Avatar answered Oct 15 '22 21:10

Robins Gupta