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

Handle coffeescript gulpfile patterns (feature) #5

Closed guillaume86 closed 10 years ago

guillaume86 commented 10 years ago

The recommanded pattern for coffeescript gulpfiles is to create a gulpfile.js like this:

require('coffee-script/register');
require('./gulpfile.coffee');

And then write the proper gulpfile in gulpfile.coffee. Could you detect this case and just compile in memory the gulpfile to js before extracting the task names? (too bad doesn't have a command to list tasks, would make all this a lot easier)

nicosantangelo commented 10 years ago

I never used a .coffee but I think this could be achievable. I'll try to get one working to see how I can list the tasks, I'll let you know how it goes here.

As you said, the lack of a command to list makes this a bit complex when it shouldn't be (the same happens with a .js gulpfile, it would be so much easier if I could just do gulp list).

guillaume86 commented 10 years ago

Actually it was easier than I tought, no need for changes, just exporting in the gulpfile.coffee

module.exports = gulp

and creating the gulp variable in the gulpfile.js did the job

require('coffee-script/register');
var gulp = require('./gulpfile.coffee');

a little page in the wiki would do the job to avoid future requests like this one ;). Thanks for the good work on the plugin!

nicosantangelo commented 10 years ago

Awesome!

I took a really different path solving this and it wasn't nice. I was trying to integrate the flag --require coffee-script/register in the call to gulp if a .coffee was found, but it's kind of troublesome, this is a lot better (at least for now).

I'll add the info in the README and wiki, thanks!!

nicosantangelo commented 10 years ago

I have to work in a good Wiki page on how to use the package and avoid potential issues, but for now, the info is in the README. I've added a mention to your username there, if you don't like it please let me know :).

Thanks again!

guillaume86 commented 10 years ago

No problem! Le 12 mai 2014 19:03, "Nicolás Santángelo" notifications@github.com a écrit :

I have to work in a good Wiki page on how to use the package and avoid potential issues, but for now, the info is in the README. I've added a mention to your username there, if you don't like it please let me know :).

Thanks again!

— Reply to this email directly or view it on GitHubhttps://github.com/NicoSantangelo/sublime-gulp/issues/5#issuecomment-42858928 .

fritx commented 10 years ago

too bad doesn't have a command to list tasks

Now gulp has a command to list tasks - $ gulp --task-simple See: https://github.com/gulpjs/gulp/issues/472

nicosantangelo commented 10 years ago

This makes the listing a lot easier. I'll take a look to se if I can implement it, I think I should leave the node version as an option anyways, to support older versions of gulp.

Thanks!