css-preflight 2.0.1 → 2.0.3
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/LICENSE.md +1 -1
- package/LICENSE_TAILWIND.md +0 -3
- package/README.md +12 -40
- package/index.d.ts +1 -0
- package/package.json +13 -21
package/LICENSE.md
CHANGED
package/LICENSE_TAILWIND.md
CHANGED
package/README.md
CHANGED
|
@@ -1,31 +1,19 @@
|
|
|
1
1
|
# CSS Preflight
|
|
2
2
|
|
|
3
|
-
This is a CSS browser reset based on Tailwind's preflight, optimized for
|
|
4
|
-
non-Tailwind projects. Optional enhancements like smooth scrolling and
|
|
5
|
-
other utilities are also provided.
|
|
3
|
+
This is a CSS browser reset based on Tailwind's preflight, optimized for non-Tailwind projects. Optional enhancements like smooth scrolling and other utilities are also provided.
|
|
6
4
|
|
|
7
5
|
## Differences to Tailwind's Preflight
|
|
8
6
|
|
|
9
7
|
The following adjustments have been made to the preflight:
|
|
10
8
|
|
|
11
9
|
1. Tailwind-specific CSS variables and styling removed.
|
|
12
|
-
2. Two Tailwind `font-family` defaults have been removed from the
|
|
13
|
-
preflight in favor of optional imports. One was setting the
|
|
14
|
-
default font stack for the overall HTML document, and the other
|
|
15
|
-
was setting monospace fonts for HTML elements like `code`.
|
|
10
|
+
2. Two Tailwind `font-family` defaults have been removed from the preflight in favor of optional imports. One was setting the default font stack for the overall HTML document, and the other was setting monospace fonts for HTML elements like `code`.
|
|
16
11
|
|
|
17
12
|
#### Why Font Family Defaults Removed
|
|
18
13
|
|
|
19
|
-
Font stacks are a rapidly evolving space at the moment, and the use of
|
|
20
|
-
system fonts is becoming more common, such as in Tailwind's
|
|
21
|
-
preflight. However, the use of `system-ui` and similar values for the `font-family`
|
|
22
|
-
property can be problematic. They not only depend on the OS version,
|
|
23
|
-
but on the language settings of the OS as well, which can be unpredictable,
|
|
24
|
-
according to the following article: https://infinnie.github.io/blog/2017/systemui.html.
|
|
14
|
+
Font stacks are a rapidly evolving space at the moment, and the use of system fonts is becoming more common, such as in Tailwind's preflight. However, the use of `system-ui` and similar values for the `font-family` property can be problematic. They not only depend on the OS version, but on the language settings of the OS as well, which can be unpredictable, according to the following article: https://infinnie.github.io/blog/2017/systemui.html.
|
|
25
15
|
|
|
26
|
-
Granted, this is an older article, but as a precaution, `font-family` defaults
|
|
27
|
-
have been moved to optional imports with possible system fonts being manually
|
|
28
|
-
specified over the usage of `system-ui`, `monospace-ui`, etc.
|
|
16
|
+
Granted, this is an older article, but as a precaution, `font-family` defaults have been moved to optional imports with possible system fonts being manually specified over the usage of `system-ui`, `monospace-ui`, etc.
|
|
29
17
|
|
|
30
18
|
## Installation
|
|
31
19
|
|
|
@@ -39,8 +27,7 @@ npm install css-preflight
|
|
|
39
27
|
|
|
40
28
|
## Typical Usage
|
|
41
29
|
|
|
42
|
-
Note this setup doesn't contain any defaults for the main font. Those are
|
|
43
|
-
available as optional imports.
|
|
30
|
+
Note this setup doesn't contain any defaults for the main font. Those are available as optional imports.
|
|
44
31
|
|
|
45
32
|
```javascript
|
|
46
33
|
// main preflight
|
|
@@ -52,11 +39,7 @@ import "css-preflight/preflight.css";
|
|
|
52
39
|
import "css-preflight/mono-elements.css";
|
|
53
40
|
```
|
|
54
41
|
|
|
55
|
-
For fastest performance, it's recommended to have the CSS directly
|
|
56
|
-
injected into the HTML as a `<style>` tag, along with any other critical
|
|
57
|
-
CSS applying to above-the-fold content. Avoid putting the `<style>` tag
|
|
58
|
-
inside `<head>` as invalid CSS can break processing of other elements
|
|
59
|
-
inside `<head>`.
|
|
42
|
+
For fastest performance, it's recommended to have the CSS directly injected into the HTML as a `<style>` tag, along with any other critical CSS applying to above-the-fold content. Avoid putting the `<style>` tag inside `<head>` as invalid CSS can break processing of other elements inside `<head>`.
|
|
60
43
|
|
|
61
44
|
```html
|
|
62
45
|
<head></head>
|
|
@@ -68,8 +51,7 @@ inside `<head>`.
|
|
|
68
51
|
</body>
|
|
69
52
|
```
|
|
70
53
|
|
|
71
|
-
Reminder to set emoji font fallbacks when defining your own
|
|
72
|
-
font stacks:
|
|
54
|
+
Reminder to set emoji font fallbacks when defining your own font stacks:
|
|
73
55
|
|
|
74
56
|
```css
|
|
75
57
|
:root,
|
|
@@ -105,9 +87,7 @@ import "css-preflight/preflight.css"; // styles/preflight.css
|
|
|
105
87
|
|
|
106
88
|
### Default Main Fonts
|
|
107
89
|
|
|
108
|
-
Sets a default main font for the document (body text, headings, etc.) Only applies these
|
|
109
|
-
to `:root` and `:host`, to be inherited by other elements. Useful in development when
|
|
110
|
-
no main font has been chosen for the design yet, or for simple testing purposes.
|
|
90
|
+
Sets a default main font for the document (body text, headings, etc.) Only applies these to `:root` and `:host`, to be inherited by other elements. Useful in development when no main font has been chosen for the design yet, or for simple testing purposes.
|
|
111
91
|
|
|
112
92
|
#### Mono
|
|
113
93
|
|
|
@@ -129,9 +109,7 @@ import "css-preflight/font-serif.css";
|
|
|
129
109
|
|
|
130
110
|
### Mono Elements
|
|
131
111
|
|
|
132
|
-
Sets a default monospace font stack for the `code`, `kbd`, `samp`, and `pre`
|
|
133
|
-
HTML elements. Many design and branding systems don't include
|
|
134
|
-
monospace font guidelines so this option can be useful for those cases.
|
|
112
|
+
Sets a default monospace font stack for the `code`, `kbd`, `samp`, and `pre` HTML elements. Many design and branding systems don't include monospace font guidelines so this option can be useful for those cases.
|
|
135
113
|
|
|
136
114
|
```javascript
|
|
137
115
|
import "css-preflight/mono-elements.css";
|
|
@@ -139,10 +117,7 @@ import "css-preflight/mono-elements.css";
|
|
|
139
117
|
|
|
140
118
|
### Rem Same Px
|
|
141
119
|
|
|
142
|
-
Sets `1 rem = 1px` at the root for easier design-dev hand-off. This calculation
|
|
143
|
-
is done using `%`, so if the user adjusts the browser font sizes, those will
|
|
144
|
-
still affect the page for accessibility purposes. Note this may affect
|
|
145
|
-
framework error debug message pages in development (e.g. Nuxt, Next, Astro, etc.).
|
|
120
|
+
Sets `1 rem = 1px` at the root for easier design-dev hand-off. This calculation is done using `%`, so if the user adjusts the browser font sizes, those will still affect the page for accessibility purposes. Note this may affect framework error debug message pages in development (e.g. Nuxt, Next, Astro, etc.).
|
|
146
121
|
|
|
147
122
|
```javascript
|
|
148
123
|
import "css-preflight/rem-same-px.css"; // styles/rem-same-px.css
|
|
@@ -158,8 +133,7 @@ import "css-preflight/smooth-scroll.css"; // styles/smooth-scroll.css
|
|
|
158
133
|
|
|
159
134
|
### Text Wrap Balance
|
|
160
135
|
|
|
161
|
-
Adds `text-wrap: balance` on h1-h6 and blockquote. Helps prevent single hanging words on
|
|
162
|
-
heading newlines.
|
|
136
|
+
Adds `text-wrap: balance` on h1-h6 and blockquote. Helps prevent single hanging words on heading newlines.
|
|
163
137
|
|
|
164
138
|
```javascript
|
|
165
139
|
import "css-preflight/text-wrap-balance.css"; // styles/text-wrap-balance.css
|
|
@@ -167,6 +141,4 @@ import "css-preflight/text-wrap-balance.css"; // styles/text-wrap-balance.css
|
|
|
167
141
|
|
|
168
142
|
## License
|
|
169
143
|
|
|
170
|
-
The repo falls under MIT licensing, contained in the LICENSE.md file.
|
|
171
|
-
Usage of the `preflight.css` file is also subject to Tailwind's licensing (MIT), which is included
|
|
172
|
-
in the repo for reference.
|
|
144
|
+
The repo falls under MIT licensing, contained in the LICENSE.md file. Usage of the `preflight.css` file is also subject to Tailwind's licensing (MIT), which is included in the repo for reference.
|
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "css-preflight",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.3",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"description": "CSS browser reset based on Tailwind's preflight, with optional enhancements.",
|
|
@@ -13,7 +13,11 @@
|
|
|
13
13
|
"homepage": "https://github.com/woodbrettm/css-preflight",
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|
|
16
|
-
"url": "https://github.com/woodbrettm/css-preflight"
|
|
16
|
+
"url": "git+https://github.com/woodbrettm/css-preflight",
|
|
17
|
+
"directory": "package"
|
|
18
|
+
},
|
|
19
|
+
"publishConfig": {
|
|
20
|
+
"provenance": true
|
|
17
21
|
},
|
|
18
22
|
"keywords": [
|
|
19
23
|
"css",
|
|
@@ -23,10 +27,11 @@
|
|
|
23
27
|
"normalizer",
|
|
24
28
|
"browser"
|
|
25
29
|
],
|
|
26
|
-
"main": "./styles/preflight.css",
|
|
27
|
-
"style": "./styles/preflight.css",
|
|
28
30
|
"exports": {
|
|
29
|
-
".":
|
|
31
|
+
".": {
|
|
32
|
+
"types": "./index.d.ts",
|
|
33
|
+
"default": "./styles/preflight.css"
|
|
34
|
+
},
|
|
30
35
|
"./preflight.css": "./styles/preflight.css",
|
|
31
36
|
"./font-mono.css": "./styles/font-mono.css",
|
|
32
37
|
"./font-sans-serif.css": "./styles/font-sans-serif.css",
|
|
@@ -41,20 +46,7 @@
|
|
|
41
46
|
"LICENSE_TAILWIND.md",
|
|
42
47
|
"styles",
|
|
43
48
|
"package.json",
|
|
44
|
-
"README.md"
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
"@changesets/cli": "2.29.5",
|
|
48
|
-
"prettier": "3.6.2",
|
|
49
|
-
"vite": "7.0.4",
|
|
50
|
-
"eslint": "9.31.0",
|
|
51
|
-
"@eslint/css": "0.10.0"
|
|
52
|
-
},
|
|
53
|
-
"scripts": {
|
|
54
|
-
"changeset:version": "changeset version",
|
|
55
|
-
"changeset:add": "changeset",
|
|
56
|
-
"changeset:release": "changeset publish",
|
|
57
|
-
"dev": "vite dev --config \"./playground/vite.config.js\"",
|
|
58
|
-
"lint:css": "eslint \"./styles/**\""
|
|
59
|
-
}
|
|
49
|
+
"README.md",
|
|
50
|
+
"index.d.ts"
|
|
51
|
+
]
|
|
60
52
|
}
|