Skip to content

Commit 0d393a6

Browse files
committed
Change -m flag value to true by default
1 parent 301f880 commit 0d393a6

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and 
1616
- The processing of a specific image will now be skipped if the originDensity specified does not equal the maxDensity value available for that image in the metadata file.
1717
- The processing of a specific image will now be skipped if the target formats specified do not match those available in the metadata file for that image.
1818
- The breakpoint suffix in raster image file names must now begin with `~` instead of `-`. For example, `cat-768.png` must be renamed to `cat~768.png`.
19+
- The `-m` (`--add-meta-data`) flag is now enabled by default. Use `--no-m` (`--no-add-meta-data`) to disable it.
1920
- The name of the JSON metadata file now has the suffix `.meta`.
2021
- The name of the JS metadata file now has the suffix `.imports`.
2122
- The JS metadata file now exports only an array with dynamic imports.

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,19 +102,19 @@ Optimize is invoked via the command line:
102102

103103
#### `-m`, `--add-meta-data`
104104

105-
- _Default:_ `false`
105+
- _Default:_ `true`
106106
- _Description:_ Create JSON and JS files with metadata of the raster images and CSS file for the icons
107107

108-
> #### Note: Don’t forget to specify the `-m` flag
108+
> #### Tip: Canceling the addition of metadata files
109109
>
110-
> When processing raster images, the `-m` flag (`--add-meta-data`) enables the generation of metadata files. Metadata files are useful for generating the `picture` tag. JS files are needed in Vite-based frameworks (such as Astro) because their dynamic imports during project build return paths to hashed files. And using custom properties from the CSS icon file allows you to automatically encode icons into styles.
110+
> Metadata files are useful for generating the `picture` tag. JS files are needed in Vite-based frameworks (such as Astro) because their dynamic imports during project build return paths to hashed files. And using custom properties from the CSS icon file allows you to automatically encode icons into styles. To cancel the addition of metadata files, use the `--no-` prefix for the flag: `--no-m` or `--no-add-meta-data`.
111111
112112
### Examples
113113

114-
- In the `source/images` folder, optimize all SVGs and convert the raster images to `avif` and `webp` formats at the original size for `2x` pixel density and at a reduced size for `1x` pixel density; and after processing the raster images, delete their original files and generate JSON and JS files with metadata:
114+
- In the `source/images` folder, optimize all SVGs and convert the raster images to `avif` and `webp` formats at the original size for `2x` pixel density and at a reduced size for `1x` pixel density; and after processing the raster images, delete their original files and not generate JSON and JS files with metadata:
115115

116116
```shell
117-
optimize images --input-directory=source/images --remove-origin --add-meta-data
117+
optimize images --input-directory=source/images --remove-origin --no-add-meta-data
118118
```
119119

120120
> #### Tip for exporting raster layers from layouts
@@ -124,13 +124,13 @@ Optimize is invoked via the command line:
124124
- Take all vector and raster images from the `raws/images` folder; optimize vector images and put them in `source/images`; convert raster images to `webp` format and to the original format, optimizing them for `2x` and `1x` pixel densities, placing these results also in `source/images`; when processing is completed, delete the original raster images from `raws/images`:
125125

126126
```shell
127-
optimize images -i raws/images -o source/images -f webp -a -r
127+
optimize images -i raws/images -o source/images -f webp -a -r --no-m
128128
```
129129

130130
- Optimize SVG icons in the default `src/shared/icons` folder and create the CSS file that contain custom properties with paths to the icons:
131131

132132
```shell
133-
optimize icons -m
133+
optimize icons
134134
```
135135

136136
- In the `assets` folder, convert files `touch.svg`, `32.svg` (and optionaly `16.svg`) to:
@@ -160,7 +160,7 @@ Optimize is invoked via the command line:
160160
- run `optimize favicons` in the `public` folder,
161161

162162
```shell
163-
optimize all -r -m
163+
optimize all -r
164164
```
165165

166166
[license-url]: https://github.com/firefoxic/optimizee/blob/main/LICENSE.md

bin/cli.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,19 @@ let cli = meow(`
5050
5151
--add-meta-data -m Create JSON and JS files with metadata of the raster images
5252
and CSS file for the icons.
53-
(Default: false)
53+
(Default: true)
5454
5555
--version Print version and exit
5656
5757
--help Print this help and exit
5858
5959
Examples
6060
61-
$ optimize images --inputDirectory=source/images --removeOrigin -m
61+
$ optimize images --inputDirectory=source/images --removeOrigin
6262
$ optimize images -i raws/images -o source/images -f webp -a -r
63-
$ optimize icons
63+
$ optimize icons --no-m
6464
$ optimize favicons -p assets/favicons
65-
$ optimize all -r -m
65+
$ optimize all -r
6666
6767
`, {
6868
importMeta: import.meta,
@@ -104,7 +104,7 @@ let cli = meow(`
104104
addMetaData: {
105105
"type": `boolean`,
106106
"shortFlag": `m`,
107-
"default": false,
107+
"default": true,
108108
},
109109
},
110110
})

0 commit comments

Comments
 (0)