Skip to content

Instantly share code, notes, and snippets.

@egoist
Last active September 17, 2019 11:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save egoist/50a6bfb6092318ba0f09422b6d074831 to your computer and use it in GitHub Desktop.
Save egoist/50a6bfb6092318ba0f09422b6d074831 to your computer and use it in GitHub Desktop.

You may want to manipulate initial HTML to inject some <link>s or <script>s, you can do this with setHead in saber-browser.js or head component option, but that adds bytes to your app runtime, Saber actually has an API that allows you to customize initial HTML.

Open saber-node.js:

exports.getDocumentData = documentData => {
  documentData.bodyScript += `<script>console.log('Run a script after your app code')</script>`
  return data
}

This hook is not well documented yet, for now you can check this file for all documentData properties.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment