简体   繁体   中英

Yeoman generator overwriting Gruntfile.js variables

I have made a Yeoman Generator and am copying a folder with Grunt config inside. But the generator's variables are the same and thus Grunt is processing then and they are removed.

In the Yeoman Generator I begin the copy with:

    this.directory('grunt', 'grunt');

In a file in the grunt folder above is something like:

    dest: '<%= config.dist %>'

Which I want to stay in the file, but the Yeoman generator is processing this and all I get is a blank string.

Is there a way to disable variable processing when copying directories in a Yeoman generator?

The variables were being overwritten because I was using the key config which seems to be reserved by the Yeoman Generator.

Once I changed the variable name in the Gruntfile to settings (or anything else) then the Yeoman Generator would leave it alone and it would come into my Gruntfile correctly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM