user88831
user88831

Reputation: 327

Nuxt, Fire Node Action after Nuxt ends generation

In gatsbyjs i have hook like export.postBuild = (pages, cb) => { some code after ... }

Is there any equivalent for nuxt? I want to do some action after generation written in nodejs.

Upvotes: 0

Views: 27

Answers (1)

Ilijanovic
Ilijanovic

Reputation: 14904

Sure, the nuxt hooks: https://nuxtjs.org/api/configuration-hooks/

What you search are the generator hooks: https://nuxtjs.org/api/internals-generator#hooks

this.nuxt("generate:done", (generator, errors) => {
   //...
})

nuxt.config.js

export default {
  hooks: {
     generate: {
        done(generator, errors) {
           //... do something
        }
     }
  }
}

Upvotes: 1

Related Questions