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

Added feature "Task On Save". - #60

Closed rhaldkhein closed 8 years ago

rhaldkhein commented 8 years ago

Auto run a task when a file is saved. Task can also vary base on file types (just specify in settings file).

Additional settings example. "task_on_save": { "webpack": ".js", "stylus": ".styl", "other_task": [".ext1", ".ext2"] }

This settings can also be set per project.

nicosantangelo commented 8 years ago

Awesome!

Let me give it a try tonight before merging it.

rhaldkhein commented 8 years ago

Thanks.

Made this because I (maybe someone else) always forgot to run watch command for file changes. :)

nicosantangelo commented 8 years ago

Just tested it and it works great, thanks a lot!

A few minor things:

That's all!

rhaldkhein commented 8 years ago

Sure!

But before that, there's one issue. Tasks for specific extension (like .js file) will run on all files in project, but what if we have files that should not be affected with. Like following example diagram.

./app/view/template.js ---> (should run template compile task) ./app/controller/index.js ---> (should run webpack or browserify task) ./gulpfile.js ---> (should not run any task)

To solve this issue, regex or glob should be used. Instead of just file extension.

rhaldkhein commented 8 years ago

Hi Nico, Updated. Let me know if you need anything else. Thanks.

nicosantangelo commented 8 years ago

Perfect!

Thanks a lot for this I'll add it to the next release, this weekend