@css-inline/css-inline 0.17.0 → 0.18.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 CHANGED
@@ -117,6 +117,7 @@ var inlined = inlineFragment(
117
117
  - `keepStyleTags`. Specifies whether to keep "style" tags after inlining. Default: `false`
118
118
  - `keepLinkTags`. Specifies whether to keep "link" tags after inlining. Default: `false`
119
119
  - `keepAtRules`. Specifies whether to keep "at-rules" (starting with `@`) after inlining. Default: `false`
120
+ - `minifyCss`. Specifies whether to remove trailing semicolons and spaces between properties and values. Default: `false`
120
121
  - `baseUrl`. The base URL used to resolve relative URLs. If you'd like to load stylesheets from your filesystem, use the `file://` scheme. Default: `null`
121
122
  - `loadRemoteStylesheets`. Specifies whether remote stylesheets should be loaded. Default: `true`
122
123
  - `cache`. Specifies caching options for external stylesheets (for example, `{size: 5}`). Default: `null`
@@ -177,6 +178,19 @@ Such tags will be kept in the resulting HTML even if the `keep_style_tags` optio
177
178
  </body>
178
179
  ```
179
180
 
181
+ If you set the the `minify_css` option to `true`, the inlined styles will be minified by removing trailing semicolons
182
+ and spaces between properties and values.
183
+
184
+ ```html
185
+ <head>
186
+ <!-- With minify_css=true, the <h1> will have `style="color:blue;font-weight:bold"` -->
187
+ <style>h1 { color: blue; font-weight: bold; }</style>
188
+ </head>
189
+ <body>
190
+ <h1>Big Text</h1>
191
+ </body>
192
+ ```
193
+
180
194
  You can also cache external stylesheets to avoid excessive network requests:
181
195
 
182
196
  ```typescript
package/index.d.ts CHANGED
@@ -20,6 +20,8 @@ export interface Options {
20
20
  keepLinkTags?: boolean
21
21
  /** Keep "at-rules" after inlining. */
22
22
  keepAtRules?: boolean
23
+ /** Remove trailing semicolons and spaces between properties and values. */
24
+ minifyCss?: boolean
23
25
  /** Used for loading external stylesheets via relative URLs. */
24
26
  baseUrl?: string
25
27
  /** Whether remote stylesheets should be loaded or not. */
package/js-binding.d.ts CHANGED
@@ -19,6 +19,10 @@ export interface Options {
19
19
  keepStyleTags?: boolean
20
20
  /** Keep "link" tags after inlining. */
21
21
  keepLinkTags?: boolean
22
+ /** Keep "at-rules" after inlining. */
23
+ keepAtRules?: boolean
24
+ /** Remove trailing semicolons and spaces between properties and values. */
25
+ minifyCss?: boolean
22
26
  /** Used for loading external stylesheets via relative URLs. */
23
27
  baseUrl?: string
24
28
  /** Whether remote stylesheets should be loaded or not. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@css-inline/css-inline",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
4
4
  "description": "High-performance library for inlining CSS into HTML 'style' attributes",
5
5
  "main": "index.js",
6
6
  "repository": "https://github.com/Stranger6667/css-inline",
@@ -99,16 +99,16 @@
99
99
  },
100
100
  "packageManager": "yarn@4.9.2",
101
101
  "optionalDependencies": {
102
- "@css-inline/css-inline-win32-x64-msvc": "0.17.0",
103
- "@css-inline/css-inline-darwin-x64": "0.17.0",
104
- "@css-inline/css-inline-linux-x64-gnu": "0.17.0",
105
- "@css-inline/css-inline-darwin-arm64": "0.17.0",
106
- "@css-inline/css-inline-android-arm64": "0.17.0",
107
- "@css-inline/css-inline-win32-arm64-msvc": "0.17.0",
108
- "@css-inline/css-inline-linux-arm64-gnu": "0.17.0",
109
- "@css-inline/css-inline-linux-arm64-musl": "0.17.0",
110
- "@css-inline/css-inline-linux-arm-gnueabihf": "0.17.0",
111
- "@css-inline/css-inline-linux-x64-musl": "0.17.0",
112
- "@css-inline/css-inline-android-arm-eabi": "0.17.0"
102
+ "@css-inline/css-inline-win32-x64-msvc": "0.18.0",
103
+ "@css-inline/css-inline-darwin-x64": "0.18.0",
104
+ "@css-inline/css-inline-linux-x64-gnu": "0.18.0",
105
+ "@css-inline/css-inline-darwin-arm64": "0.18.0",
106
+ "@css-inline/css-inline-android-arm64": "0.18.0",
107
+ "@css-inline/css-inline-win32-arm64-msvc": "0.18.0",
108
+ "@css-inline/css-inline-linux-arm64-gnu": "0.18.0",
109
+ "@css-inline/css-inline-linux-arm64-musl": "0.18.0",
110
+ "@css-inline/css-inline-linux-arm-gnueabihf": "0.18.0",
111
+ "@css-inline/css-inline-linux-x64-musl": "0.18.0",
112
+ "@css-inline/css-inline-android-arm-eabi": "0.18.0"
113
113
  }
114
114
  }