Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How grunt watch files in sub folders?

My codes folders and files like this, you never know how many sub folders in it:

js/sub1/a.js js/sub2/b.js js/sub3/sub31/c.js js/sub4/sub41/sub411/d.js 

Here is part of the Gruntfile.js:

grunt.initConfig({     watch: {         src: {             files: ['js/*.js'],             tasks: []         }     } }); 

Grunt can't watch the changes of my all JavaScript files by using 'js/*.js'. So how to write the correct file path expression?

like image 317
HOT.CHO Avatar asked Mar 21 '13 08:03

HOT.CHO


People also ask

How do I see all files in a subfolder?

Enter the main folder you want to see and Ctrl + B . That will list all files within the main folder and all of its subfolders.

How do I search a sub folder?

Open Windows Explorer. Select Organize / Folder and Search options. Select the Search Tab. In the How to search section, select the Include subfolders in search results when searching in file folders option.

What is the difference between folders and sub-folders?

A subfolder is a folder stored inside another folder. Subfolders help you organize your files more completely. Each subfolder should be used to store files related to each other. For example, you might have one folder for files related to a job search.


1 Answers

Per the official documentation on file globbing, to watch for changes for files of a certain file type in the directory path and its subdirectories, you'll want:

files: ['js/**/*.js'] 
like image 77
ashox Avatar answered Sep 23 '22 10:09

ashox