gruntjs / gruntjs/grunt-init

noProcess ignore files that start with .

Open
#91 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
195
Forks
57
PR merge metrics
No merged PRs in 30d

Description

Hello Grunt,

I'm running into an issue with a custom grunt-init template. The `copyAndProcess` method looks like this

``` javascript
init.copyAndProcess(files, props, {noProcess: '{.git,node_modules,.sass-cache,.tmp,build,modules,source}/**'});
```

There's reasons the node modules are kept inside the node_modules directory and not installed afterwards which isn't particularly relevant to this issue. When running the init it errors on a file deep within the dependencies of `grunt-contrib-imagemin`

> node_modules/grunt-contrib-imagemin/node_modules/imagemin/node_modules/imagemin-
> gifsicle/node_modules/gifsicle/node_modules/bin-
> build/node_modules/download/node_modules/decompress-tar/node_modules/strip-
> dirs/node_modules/is-absolute/.verbrc.md...Warning: An error occurred while processing a template
> (name is not defined). Use --force to continue.

Inside .verbrc.md is `{%= name %}` which is never set when you run the template. As a test I created a new folder and added a file called `.test` which contained `{%= name %}` and told grunt-init to not process that folder. It ignores the noProcess and changes the `{%= name %}` to the text set in prompt.

I would expect `node_modules/**` to ignore everything within that folder and copy the contents across without processing the templates, even if it started with a dot(.)

I've been able to get it working using the following:

``` javascript
init.copyAndProcess(files, props, {noProcess: '{.git,node_modules,.sass-cache,.tmp,build,modules,source}/**/{.,}*'});
```

But I still think the basic version of ignoring the folder should've worked. Am I missing something or is this an issue?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.