Yeoman copy directory without templating
Asked Answered
S

1

9

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.?

Sarilda answered 26/11, 2015 at 13:41 Comment(0)
S
27

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' }
    );
  }
Sarilda answered 26/11, 2015 at 19:39 Comment(1)
Awesome! I needed a combination of both, thanks for the info.Microcopy

© 2022 - 2024 — McMap. All rights reserved.