Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't seem to finish running the task if the src directory is empty #2

Open
loremipson opened this issue Feb 6, 2014 · 6 comments

Comments

@loremipson
Copy link

I have this set up in a "boilerplate" gulpfile for when I occasionally use sprite images. Occasionally being my keyword here, often times, I won't ever actually be using the sprite task.

However, I'd still like my watch task to watch the directory, just in case. But if the src directory doesn't have any images to turn into a sprite, it looks like it's not finishing and more or less killing the watch task, making it so my other tasks in watch never fire.

If there are images in the src directory, it generates fine and the rest of the watch tasks fire fine. It really just seems to be if there's nothing for the sprite task to do.

@aslansky
Copy link
Owner

aslansky commented Feb 6, 2014

Hey Tyler, thanks for reporting. Can you please post your gulpfile so I can have a look into it. I tried with an empty src dir with a test gulpfile and it seems to work fine.

@loremipson
Copy link
Author

Huh, that's interesting. It might be something else then. Here's my gulpfile, (sorry for the lack of comments at the moment) if I run the gulp sprites task by itself (outside of the watch task), the notify message doesn't show up for me unless images are in the _src/sprites folder. That left me with the assumption that the empty directory was causing it to fail.

Thanks for taking a look.

@aslansky
Copy link
Owner

aslansky commented Feb 7, 2014

Mh, i did npm install and then gulp init. After starting gulp sprite the output looks as follows:

git master* → gulp sprites
[gulp] Using file /Users/alexander/Development/tests/gulpproject/gulpfile.js
[gulp] Working directory changed to /Users/alexander/Development/tests/gulpproject
[gulp] Running 'sprites'...
[gulp] Finished 'sprites' in 68 ms

gulp watch seems also to work pretty much as supposed to.

By the way ... you could use node-bourbon and node-neat and then in your styles task do something like:

var bourbon = require('node-bourbon').includePaths;
var neat = require('node-neat').includePaths;

...

.pipe(sass({
  includePaths: ['./src/scss'].concat(bourbon).concat(neat)
}))

So you don't need to init bourbon and neat in gulp init

@aslansky aslansky closed this as completed Feb 7, 2014
@aslansky aslansky reopened this Feb 7, 2014
@aslansky
Copy link
Owner

aslansky commented Feb 7, 2014

Maybe there is a mismatch with the local and global gulp version?

git master* → gulp --version
[gulp] CLI version 3.5.2
[gulp] Local version 3.5.2

@loremipson
Copy link
Author

Huh, when you run just gulp sprite with an empty _src/sprites, do you get the "Sprites task completed" notification? If it isn't empty, I get the notification, but nothing otherwise. Maybe that's how gulp-notify intends, but it's what made me think the issue lied there.

The watch task works initially for me, but if I go in and save or add a file, it seems to stop. Says it's running, but it won't actually trigger the the tasks it seems. I'm not sure, this may be completely unrelated to gulp-sprite, but if I comment out my sprite task, it works continuously without issue.

I have both 3.5.2 CLI and local as well.

I'll keep playing around with it, see if I can get something more specific pinpointed. Thanks again for taking a look, and for the bourbon/neat tip, didn't know about that.

@aslansky
Copy link
Owner

aslansky commented Feb 7, 2014

I did a bit more research and could find some things:

  1. gulp-notify only notifies if a file is present, so the behavior when the directory is empty is correct
  2. there was a bug in gulp-sprite which resulted in a segmentation fault when a new file was added while watching the directory (fixed with d29515c)
  3. when the directory is empty and a file is added nothing happens. This seems to be a problem with gulp.watch because I can reproduce the same behavior when I leave the scripts directory empty and add a new js file after starting gulp watch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants