-
Notifications
You must be signed in to change notification settings - Fork 19
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
Use parcelify with Gulp #9
Comments
Hi @mbektimirov! Can you elaborate on how you'd like to use the two tools together? |
Browsersync, watch, copy are priority tasks, for example. |
Hi @mbektimirov, You can call parcelify directly via its API from a gulp file. Just require parcelify and call it with the appropriate options. (Check out how this is done in cartero for an example.) watch functionality is built into parcelify (and it is very efficient), so I don't think you'll need / want to setup a watch task that re-runs parcelify from gulp. However, you might want to watch the parcelify output and do certain things when those files change. Does that answer your question? Let me know and we happy to help if anything else comes up. |
+1 |
I need it too |
Hello, I have a question regarding the built-in watch functionality and the ability to As far as I can tell Parcelify emits a "bundleWritten" event every time a watched bundle is updated. (https://github.com/rotundasoftware/parcelify/blob/master/index.js#L285) ... However, when the package.json is updated, all bundles are rewritten and at the end of this process it seems that no outward-facing event is emitted from Parcelify (see here: https://github.com/rotundasoftware/parcelify/blob/master/lib/parcel.js#L110) ... Might it be possible to add an event for this case as well, so external tooling can also listen for that? |
HI @mischkl ! Thanks for the request. Can you expand a little bit on the use case here? What are you trying to accomplish? Why are the individual |
@dgbeck @mischkl we're interested in the package.json updates and individual stylesheet updates because we bundle the assets referenced by them (in stylesheets: url properties, in package.json: a special properties with other assets to be bundled). We would really need these extra events to be triggered. |
I'll try to elaborate. We have a tool that takes the output from Parcelify, moves all reference image assets into a custom folder structure and rewrites the image paths in the CSS. Since we don't want to have to copy everything, but instead just move/modify the existing output files, a simple "gulp watch" is not an option. Basically it is great that we get "bundleWritten" events every time an asset is updated -- however in the case that a package.json is updated it seems these events never get emitted. Yes the var eventsToRelay = [ 'assetUpdated', 'packageJsonUpdated', 'bundleWritten" ]; Additionally it might be useful to have an event be emitted after all bundles have been rewritten due to a package.json update, something like |
Edit: my bad, copy-paste failure, forgot to change the event name on logging. |
So I've played a bit with the 'watch' functionality from parcelify and the
Any way we can intercept this @dgbeck ? tnx Edit: silly me, it works via a |
For future reference, here's how you can listen to everything: var p = parcelify(b, options)
.on('error', cb)
.on('done', function() {
//...
});
p.on('packageCreated', function(pkg, isMain) {
debug('packageCreated', pkg, isMain);
});
p.on('packageJsonUpdated', function() {
debug('packageJsonUpdated', arguments);
});
p.on('assetUpdated', function(eventType, asset) {
debug('assetUpdated', eventType, asset);
});
p.on('bundleWritten', function() {
debug('bundleWritten', arguments);
}); |
Hi @alessioalex and @mischkl !
So it looks like there is a bug where Thanks for the feedback and additional info! |
Is there any solution to use parcelify with Gulp?
The text was updated successfully, but these errors were encountered: