Skip to content

Commit

Permalink
Merge branch 'master' into docs/beta-features/manual-initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
martinjagodic authored Jan 23, 2024
2 parents 39973ba + 5623d81 commit 568c2ec
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 51 deletions.
51 changes: 0 additions & 51 deletions website/content/docs/beta-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,19 +111,6 @@ Decap CMS always creates its own DOM element for mounting the application, which
You can now provide your own element for Decap CMS to mount in by setting the target element's ID as `nc-root`. If Decap CMS finds an element with this ID during initialization, it will mount within that element instead of creating its own.


## 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
/**
* Assumes a webpack project with `sass-loader` and `css-loader` installed.
* Takes advantage of the `toString` method in the return value of `css-loader`.
*/
import CMS from 'decap-cms-app';
import styles from '!css-loader!sass-loader!../main.scss';
CMS.registerPreviewStyle(styles.toString(), { raw: true });
```

## Squash merge GitHub pull requests

Expand All @@ -138,44 +125,6 @@ backend:
squash_merges: true
```

## Commit Message Templates

You can customize the templates used by Decap CMS to generate commit messages by setting the `commit_messages` option under `backend` in your Decap 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.

Setting up your Decap CMS `config.yml` to recreate the default values would look like this:

```yaml
backend:
commit_messages:
create: Create {{collection}} “{{slug}}”
update: Update {{collection}} “{{slug}}”
delete: Delete {{collection}} “{{slug}}”
uploadMedia: Upload “{{path}}”
deleteMedia: Delete “{{path}}”
openAuthoring: '{{message}}'
```

Decap CMS generates the following commit types:

| Commit type | When is it triggered? | Available template tags |
| --------------- | ---------------------------------------- | ----------------------------------------------------------- |
| `create` | A new entry is created | `slug`, `path`, `collection`, `author-login`, `author-name` |
| `update` | An existing entry is changed | `slug`, `path`, `collection`, `author-login`, `author-name` |
| `delete` | An existing entry is deleted | `slug`, `path`, `collection`, `author-login`, `author-name` |
| `uploadMedia` | A media file is uploaded | `path`, `author-login`, `author-name` |
| `deleteMedia` | A media file is deleted | `path`, `author-login`, `author-name` |
| `openAuthoring` | A commit is made via a forked repository | `message`, `author-login`, `author-name` |

Template tags produce the following output:

* `{{slug}}`: the url-safe filename of the entry changed
* `{{collection}}`: the name of the collection containing the entry changed
* `{{path}}`: the full path to the file changed
* `{{message}}`: the relevant message based on the current change (e.g. the `create` message when an entry is created)
* `{{author-login}}`: the login/username of the author
* `{{author-name}}`: the full name of the author (might be empty based on the user's profile)

## Image widget file size limit

Expand Down
40 changes: 40 additions & 0 deletions website/content/docs/configuration-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,46 @@ The `backend` option specifies how to access the content for your site, includin

**Note**: no matter where you access Decap CMS — whether running locally, in a staging environment, or in your published site — it will always fetch and commit files in your hosted repository (for example, on GitHub), on the branch you configured in your Decap CMS config.yml file. This means that content fetched in the admin UI will match the content in the repository, which may be different from your locally running site. It also means that content saved using the admin UI will save directly to the hosted repository, even if you're running the UI locally or in staging. If you want to have your local CMS write to a local repository, try the `local_backend` setting, [currently in beta](/docs/beta-features/#working-with-a-local-git-repository).

### Commit Message Templates

You can customize the templates used by Decap CMS to generate commit messages by setting the `commit_messages` option under `backend` in your Decap 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.

Setting up your Decap CMS `config.yml` to recreate the default values would look like this:

```yaml
backend:
commit_messages:
create: Create {{collection}} “{{slug}}”
update: Update {{collection}} “{{slug}}”
delete: Delete {{collection}} “{{slug}}”
uploadMedia: Upload “{{path}}”
deleteMedia: Delete “{{path}}”
openAuthoring: '{{message}}'
```
Decap CMS generates the following commit types:
| Commit type | When is it triggered? | Available template tags |
| --------------- | ---------------------------------------- | ----------------------------------------------------------- |
| `create` | A new entry is created | `slug`, `path`, `collection`, `author-login`, `author-name` |
| `update` | An existing entry is changed | `slug`, `path`, `collection`, `author-login`, `author-name` |
| `delete` | An existing entry is deleted | `slug`, `path`, `collection`, `author-login`, `author-name` |
| `uploadMedia` | A media file is uploaded | `path`, `author-login`, `author-name` |
| `deleteMedia` | A media file is deleted | `path`, `author-login`, `author-name` |
| `openAuthoring` | A commit is made via a forked repository | `message`, `author-login`, `author-name` |

Template tags produce the following output:

* `{{slug}}`: the url-safe filename of the entry changed
* `{{collection}}`: the name of the collection containing the entry changed
* `{{path}}`: the full path to the file changed
* `{{message}}`: the relevant message based on the current change (e.g. the `create` message when an entry is created)
* `{{author-login}}`: the login/username of the author
* `{{author-name}}`: the full name of the author (might be empty based on the user's profile)


## Publish Mode

By default, all entries created or edited in the Decap CMS are committed directly into the main repository branch.
Expand Down
15 changes: 15 additions & 0 deletions website/content/docs/customization.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,21 @@ body {
}
```

## 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
/**
* Assumes a webpack project with `sass-loader` and `css-loader` installed.
* Takes advantage of the `toString` method in the return value of `css-loader`.
*/
import CMS from 'decap-cms-app';
import styles from '!css-loader!sass-loader!../main.scss';
CMS.registerPreviewStyle(styles.toString(), { raw: true });
```


## `registerPreviewTemplate`

Registers a template for a folder collection or an individual file in a file collection.
Expand Down

0 comments on commit 568c2ec

Please sign in to comment.