nicosantangelo / sublime-gulp

Run Gulp tasks and use snippets from Sublime Text
https://sublime-gulp.nicosantangelo.com/
MIT License
155 stars 18 forks source link

Multiple gulpfiles in project? #74

Closed PixelT closed 7 years ago

PixelT commented 7 years ago

Hi

I have project with templates system - each template have his own gulpfile.js The gulpfile in compare to root folder is nested inside 4 or 5 folders

How to configure gulpfile, to detect all this gulpfiles? (is there any other method instead hardcoded the path in gulpfile_paths)?

I put into Gulp plugin - Settings User line:

{
    "check_for_gulpfile": false
}

but when I try run gulp, then I have error:

fs.js:549
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^

TypeError: path must be a string
    at TypeError (native)
    at Object.fs.openSync (fs.js:549:18)
    at Object.fs.readFileSync (fs.js:397:15)
    at requireGulp (/Users/krzysiek/Library/Application Support/Sublime Text 3/Packages/Gulp/write_tasks_to_cache.js:24:22)
    at Object.<anonymous> (/Users/krzysiek/Library/Application Support/Sublime Text 3/Packages/Gulp/write_tasks_to_cache.js:83:12)
    at Module._compile (module.js:435:26)
    at Object.Module._extensions..js (module.js:442:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Function.Module.runMain (module.js:467:10)
nicosantangelo commented 7 years ago

Hi!

check_for_gulpfile it's not the best named option, but I think the one you're looking for is gulpfile_paths.

For example, if I add the project folder from the following structure to Sublime

├── project
│   └── apps
│         └── app
│             └── gulpfile.js

I would add the following to my gulpfile_paths setting:

    "gulpfile_paths": ["apps/app"],

That way the package should search in the nested folder (this isn't the default behaviour for performance reasons)

Let me know if it helped

PixelT commented 7 years ago

@NicoSantangelo As I say in first post:

How to configure gulpfile, to detect all this gulpfiles? (is there any other method instead hardcoded the path in gulpfile_paths)?

I know the gulpfile_path option, but I work in different project with different path to gulpfile, so when I change project I must change the paths (I don't use settings per project, but global settings, so if some paths doesn't exist, the plugin return error and stop working...)

I mean about option, which will be automatically scan all files in my project and return the list of gulpfile.js files :)

nicosantangelo commented 7 years ago

Whoops, sorry, I answered in a hurry.

There's currently no way to do that. I usually have each top level folder added to Sublime and in the few cases when I don't, gulpfile_paths does the job so I never gave it much thought.

I think it's a good idea! but first I would like to give another try to the inclusion of a setting to check all folders recursively, adding (yet another) setting to ignore folders (like node_modules). Even if that does not work I have the groundwork for a Gulp: find gulpfiles command which shows each gulpfile.js path (not found in the root folders) in the output panel, ready to be added to gulpfile_paths.

Do you have a better idea on how it should work? I'll leave this issue open and give it a try (but I don't know how soon)

nicosantangelo commented 7 years ago

@PixelT This is up!, you should be able to use this feature toggling the new recursive_gulpfile_search setting in the v6.1.0 tag.

Let me know if you have a problem and I'll re-open the issue, thanks!