docs: update manual init docs (#3815)

This commit is contained in:
Erez Rokah 2020-05-26 17:12:53 +03:00 committed by GitHub
parent 624b7ff14b
commit 90ebee9abb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -239,9 +239,7 @@ You can now provide your own element for Netlify CMS to mount in by setting the
Netlify CMS can now be manually initialized, rather than automatically loading up the moment you import it. The whole point of this at the moment is to inject configuration into Netlify CMS before it loads, bypassing need for an actual Netlify CMS `config.yml`. This is important, for example, when creating tight integrations with static site generators.
Injecting config is technically already possible by setting `window.CMS_CONFIG` before importing/requiring/running Netlify CMS, but most projects are modular and don't want to use globals, plus `window.CMS_CONFIG` is an internal, not technically supported, and provides no validation.
Assuming you have the netlify-cms package installed to your project, manual initialization works like this:
Assuming you have the netlify-cms package installed to your project, manual initialization works by setting `window.CMS_MANUAL_INIT = true` **before importing the CMS**:
```js
// This global flag enables manual initialization.