Igor Bychkov
Igor Bychkov

Reputation: 33

JavaScript (grunt): regular expressions for path to a file

I'm working with gruntfile.js and I'm trying to create regular expression for path to files, for example:

.settings/.file1

directory/.settings/file.js

dir-001/.settings/subdir/.file2

dir/org.com.pack/.file3

My latest solution: **/*

But it's not correct, all files & folders that include '.' just ignored. I have no idea how to resolve this.

Please, help me with this.

Upvotes: 2

Views: 299

Answers (2)

Thibault
Thibault

Reputation: 1596

Gruntfile.js is using node-glob syntax, see the docs about . files. So you can use :

  ['**/*', '.*/**/*', '**/.*', '**/.*/**/*']

Or use the configuration dot:true (but I don't know where to put it in the Gruntfile.js)

Upvotes: 1

jkdba
jkdba

Reputation: 2509

You can use a regex like this:

.*(\/\.?){0,}.+

Live Example

Upvotes: 0

Related Questions