chore: add code formatting and linting (#952)
This commit is contained in:
@ -9,6 +9,7 @@ We run new functionality in an open beta format from time to time. That means th
|
||||
**Use these features at your own risk.**
|
||||
|
||||
## Custom Mount Element
|
||||
|
||||
Netlify CMS always creates it's own DOM element for mounting the application, which means it always
|
||||
takes over the entire page, and is generally inflexible if you're trying to do something creative,
|
||||
like injecting it into a shared context.
|
||||
@ -18,6 +19,7 @@ as `nc-root`. If Netlify CMS finds an element with this ID during initialization
|
||||
within that element instead of creating it's own.
|
||||
|
||||
## Manual Initialization
|
||||
|
||||
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.
|
||||
@ -65,6 +67,7 @@ CMS.registerPreviewTemplate(...);
|
||||
```
|
||||
|
||||
## Raw CSS in `registerPreviewStyle`
|
||||
|
||||
`registerPreviewStyle` can now accept a CSS string, in addition to accepting a url. The feature is activated by passing in an object as the second argument, with `raw` set to a truthy value.This is critical for integrating with modern build tooling. Here's an example using webpack:
|
||||
|
||||
```js
|
||||
@ -73,12 +76,13 @@ CMS.registerPreviewTemplate(...);
|
||||
* Takes advantage of the `toString` method in the return value of `css-loader`.
|
||||
*/
|
||||
import CMS from 'netlify-cms';
|
||||
import styles from '!css-loader!sass-loader!../main.scss'
|
||||
import styles from '!css-loader!sass-loader!../main.scss';
|
||||
|
||||
CMS.registerPreviewStyle(styles.toString(), { raw: true })
|
||||
CMS.registerPreviewStyle(styles.toString(), { raw: true });
|
||||
```
|
||||
|
||||
## Squash merge GitHub pull requests
|
||||
|
||||
When using the [Editorial Workflow](/docs/configuration-options/#publish-mode) with the `github` or GitHub-connected `git-gateway` backends, Netlify CMS creates a pull request for each unpublished entry. Every time the unpublished entry is changed and saved, a new commit is added to the pull request. When the entry is published, the pull request is merged, and all of those commits are added to your project commit history in a merge commit.
|
||||
|
||||
The squash merge option causes all commits to be "squashed" into a single commit when the pull request is merged, and the resulting commit is rebased onto the target branch, avoiding the merge commit altogether.
|
||||
@ -91,6 +95,7 @@ backend:
|
||||
```
|
||||
|
||||
## Commit Message Templates
|
||||
|
||||
You can customize the templates used by Netlify CMS to generate commit messages by setting the `commit_messages` option under `backend` in your Netlify CMS `config.yml`.
|
||||
|
||||
Template tags wrapped in curly braces will be expanded to include information about the file changed by the commit. For example, `{{path}}` will include the full path to the file changed.
|
||||
@ -109,13 +114,13 @@ backend:
|
||||
|
||||
Netlify CMS generates the following commit types:
|
||||
|
||||
Commit type | When is it triggered? | Available template tags
|
||||
--------------|------------------------------|-----------------------------
|
||||
`create` | A new entry is created | `slug`, `path`, `collection`
|
||||
`update` | An existing entry is changed | `slug`, `path`, `collection`
|
||||
`delete` | An exising entry is deleted | `slug`, `path`, `collection`
|
||||
`uploadMedia` | A media file is uploaded | `path`
|
||||
`deleteMedia` | A media file is deleted | `path`
|
||||
| Commit type | When is it triggered? | Available template tags |
|
||||
| ------------- | ---------------------------- | ---------------------------- |
|
||||
| `create` | A new entry is created | `slug`, `path`, `collection` |
|
||||
| `update` | An existing entry is changed | `slug`, `path`, `collection` |
|
||||
| `delete` | An exising entry is deleted | `slug`, `path`, `collection` |
|
||||
| `uploadMedia` | A media file is uploaded | `path` |
|
||||
| `deleteMedia` | A media file is deleted | `path` |
|
||||
|
||||
Template tags produce the following output:
|
||||
|
||||
|
Reference in New Issue
Block a user