From 0e4117aaaff12545a8cc20fd5a2c99b53ef34cd0 Mon Sep 17 00:00:00 2001 From: Shawn Erquhart Date: Thu, 1 Mar 2018 17:22:16 -0500 Subject: [PATCH] =?UTF-8?q?Update=20Docs=20=E2=80=9Cadd-to-your-site?= =?UTF-8?q?=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- website/site/content/docs/add-to-your-site.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/website/site/content/docs/add-to-your-site.md b/website/site/content/docs/add-to-your-site.md index 6c3c018b..df60980e 100755 --- a/website/site/content/docs/add-to-your-site.md +++ b/website/site/content/docs/add-to-your-site.md @@ -53,6 +53,23 @@ The first file, `admin/index.html`, is the entry point for the Netlify CMS admin The second file, `admin/config.yml`, is the heart of your Netlify CMS installation, and a bit more complex. The next section covers the details. +## Installing with npm + +You can also use Netlify CMS as an npm module. Wherever you import Netlify CMS, it will automatically run, taking over the current page. Make sure the script that imports it is only run on your CMS page. First install the package and save it to your project: + +``` +npm install netlify-cms --save +``` + +Then import it (assuming your project has tooling for imports): + +``` +import CMS from 'netlify-cms' + +// Now the registry is available via the CMS object. +CMS.registerPreviewTemplate('my-template', MyTemplate) +``` + ## Configuration Configuration will be different for every site, so we'll break it down into parts. All code snippets in this section will be added to your `admin/config.yml` file.