Skip to content

Commit

Permalink
Update Docs migrate Beta Features - Raw CSS (#7054)
Browse files Browse the repository at this point in the history
  • Loading branch information
privatemaker authored Jan 23, 2024
1 parent 4e91a0b commit fed5dc8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
15 changes: 1 addition & 14 deletions website/content/docs/beta-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,19 +176,6 @@ init({
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
/**
* 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 Down Expand Up @@ -377,4 +364,4 @@ CMS.registerCustomFormat('yml', 'yml', {
fromFile: text => jsYaml.load(text),
toFile: value => jsYaml.dump(value),
});
```
```
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 fed5dc8

Please sign in to comment.