@sveltia/cms 0.68.0 → 0.69.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -9
- package/dist/sveltia-cms.js +119 -119
- package/dist/sveltia-cms.js.map +1 -1
- package/dist/sveltia-cms.mjs +117 -117
- package/dist/sveltia-cms.mjs.map +1 -1
- package/package.json +1 -1
- package/types/public.d.ts +18 -1
package/README.md
CHANGED
|
@@ -67,7 +67,7 @@ The free, open source alternative to Netlify/Decap CMS is now in public beta, tu
|
|
|
67
67
|
- [Disabling non-default locale content](#disabling-non-default-locale-content)
|
|
68
68
|
- [Using a random ID for an entry slug](#using-a-random-id-for-an-entry-slug)
|
|
69
69
|
- [Configuring multiple media libraries](#configuring-multiple-media-libraries)
|
|
70
|
-
- [Optimizing images for
|
|
70
|
+
- [Optimizing images for upload](#optimizing-images-for-upload)
|
|
71
71
|
- [Editing data files with a top-level list](#editing-data-files-with-a-top-level-list)
|
|
72
72
|
- [Changing the input type of a DateTime field](#changing-the-input-type-of-a-datetime-field)
|
|
73
73
|
- [Controlling data output](#controlling-data-output)
|
|
@@ -478,9 +478,9 @@ Sveltia CMS has been built with a multilingual architecture from the very beginn
|
|
|
478
478
|
- Sort or filter assets by name or file type.
|
|
479
479
|
- View asset details, including size, dimensions, commit author/date and a list of entries that use the selected asset.
|
|
480
480
|
- Enhancements to media library integrations:
|
|
481
|
+
- The default media library comes with a [built-in image optimizer](#optimizing-images-for-upload). With a few lines of configuration, images uploaded by users are automatically converted to WebP format for reduced size,[^199] and it’s also possible to specify a maximum width and/or height.[^200] SVG images can also be optimized.
|
|
481
482
|
- Supports multiple media libraries with the [new `media_libraries` option](#configuring-multiple-media-libraries).[^195]
|
|
482
483
|
- The `max_file_size` option for the File/Image widget can be defined within the global `media_library` option, using `default` as the library name. It applies to all File/Image entry fields, as well as direct uploads to the Asset Library. The option can also be part of the [new `media_libraries` option](#configuring-multiple-media-libraries).
|
|
483
|
-
- The default media library comes with a [built-in image optimizer](#optimizing-images-for-uploaded). With a few lines of configuration, images uploaded by users are automatically converted to WebP format for reduced size,[^199] and it’s also possible to specify a maximum width and/or height.[^200]
|
|
484
484
|
- The global `media_folder` can be an empty string (or `.` or `/`) if you want to store assets in the root folder.
|
|
485
485
|
- PDF documents are displayed with a thumbnail image in both the Asset Library and the Select File dialog, making it easier to find the file you’re looking for.[^38]
|
|
486
486
|
- Assets stored in an entry-relative media folder are displayed in the Asset Library.[^142]
|
|
@@ -961,27 +961,34 @@ media_libraries:
|
|
|
961
961
|
defaultOperations: '/resize/800x600/'
|
|
962
962
|
```
|
|
963
963
|
|
|
964
|
-
### Optimizing images for
|
|
964
|
+
### Optimizing images for upload
|
|
965
965
|
|
|
966
|
-
Ever wanted to prevent end-users from adding huge images? The built-in optimizer in Sveltia CMS
|
|
966
|
+
Ever wanted to prevent end-users from adding huge images to your repository? The built-in optimizer in Sveltia CMS makes developers’ lives easier with a simple configuration like this:
|
|
967
967
|
|
|
968
968
|
```yaml
|
|
969
969
|
media_libraries:
|
|
970
970
|
default:
|
|
971
971
|
config:
|
|
972
972
|
transformations:
|
|
973
|
-
raster_image:
|
|
974
|
-
format: webp # only `webp` is supported
|
|
973
|
+
raster_image: # original format
|
|
974
|
+
format: webp # new format, only `webp` is supported
|
|
975
975
|
quality: 85 # default: 85
|
|
976
976
|
width: 2048 # default: original size
|
|
977
977
|
height: 2048 # default: original size
|
|
978
|
+
svg:
|
|
979
|
+
optimize: true
|
|
978
980
|
```
|
|
979
981
|
|
|
980
|
-
|
|
981
|
-
|
|
982
|
+
Then, whenever a user selects images to upload, those images are automatically optimized, all within the browser. Raster images such as PNG and JPEG are automatically converted to WebP format and resized if necessary. SVG images are minified using the [SVGO](https://github.com/svg/svgo) library.
|
|
983
|
+
|
|
984
|
+
In case you’re not aware, [WebP](https://developers.google.com/speed/webp) offers better compression than JPEG and PNG and is now [widely supported](https://caniuse.com/webp) across major browsers. So there is no reason not to use WebP on the web.
|
|
985
|
+
|
|
986
|
+
- As [noted above](#configuring-multiple-media-libraries), the `media_libraries` option can be global at the root level of `config.yml`, which applies to both entry fields and the Asset Library, or field-specific for the File/Image widgets.
|
|
987
|
+
- `raster_image` applies to any supported raster image format: `avif`, `bmp`, `gif`, `jpeg`, `png` and `webp`. If you like, you can use a specific format as key instead of `raster_image`.
|
|
982
988
|
- The `width` and `height` options are the maximum width and height, respectively. If an image is larger than the specified dimension, it will be scaled down. Smaller images will not be resized.
|
|
983
|
-
- File processing is a bit slow on Safari because [native WebP encoding](https://caniuse.com/mdn-api_htmlcanvaselement_toblob_type_parameter_webp) is not yet supported
|
|
989
|
+
- File processing is a bit slow on Safari because [native WebP encoding](https://caniuse.com/mdn-api_htmlcanvaselement_toblob_type_parameter_webp) is not yet supported and a [third-party library](https://github.com/jamsinclair/jSquash) is used instead.
|
|
984
990
|
- AVIF conversion is not supported at this time because no browser has native encoding support and the library is very slow.
|
|
991
|
+
- This feature is not intended for creating image variants in different formats and sizes. It should be done with a framework during the build process.
|
|
985
992
|
- We may add more transformation options in the future.
|
|
986
993
|
|
|
987
994
|
### Editing data files with a top-level list
|