I am building a netlify plugin that needs to rewrite some generated html files post-build (but pre-deploy). Is this type of use case supported? if so, can you share how it can be done? Alternatively, it would also work if there’s a way to add widgets/some kind of UI element from a plugin.
Another related question - build event documentation says that onSuccess and onEnd are triggered after deployment. However, when i was experimenting locally, they’re triggered as soon as the integration is built, not when the site is deployed. Is there something i’m missing?
Sorry for the newbie questions, I’m new to netlify and have zero experience with js/ts :). Thanks in advance!
i’m actually developing this plugin to be a generic one that any website can use It would be easier to ask website owners to embed this widget themselves, but IMO UX is better if it can be done automatically via a plugin
@hrishikesh re: deploy-time trigger. Can you elaborate abit more on “Those events are more useful when deploying using git than CLI.”? I’m trying build a plugin (or some kind of integration) that triggers a set of API calls after a site is deployed successfully.
A few more question about fs access (i can make a separate post about this if needed)
When i scan html files in PUBLISH_DIR, is it safe to assume that the html will be served at <root_url>/<path_to_html>? If not, is there a way to get routing information programmatically?
Is there a way to get metadata on the generated static contents? I’m particularly interested in last modified time of htmls.
Re deployment time trigger: yeah it’s more useful when running on netlify cloud build. Does it mean onEnd/onSuccess is triggered at build-time in CLI, and deploy time in cloud?
Re FS: I should’ve clarified. What i meant by “last modified time” is the last time the content of the html was modified. Suppose i build and deploy my project multiple times, i’m assuming only the updated parts of the website is pushed to CDN. Essentially i’m looking to build a “change detector” of sorts that only processes the parts of the website that was modified since last deployed
It will run as documented on the cloud. In the CLI, I’m not sure how exactly it will work, but yeah I don’t expect it to run after a deploy lke on the cloud.
That’s not available. There are ways to do something creative using the Netlify API, but not worth it, I’d say.