@wwtdev/bsds-css 3.2.1 → 3.2.2
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 +1 -106
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,108 +1,3 @@
|
|
|
1
1
|
# BSDS CSS Framework
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
```bash
|
|
6
|
-
npm install --save @wwtdev/bsds-css
|
|
7
|
-
```
|
|
8
|
-
|
|
9
|
-
You can import the minified stylesheet in your project's `main.js` like so:
|
|
10
|
-
|
|
11
|
-
```javascript
|
|
12
|
-
import '@wwtdev/bsds-css/dist/wwt-bsds.min.css'
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
## Using with Tailwind CSS
|
|
16
|
-
|
|
17
|
-
If your project uses Tailwind, complete the steps above and then [install Tailwind](https://tailwindcss.com/docs/installation) if you haven't already. You can follow the instructions in their docs with the exceptions listed below
|
|
18
|
-
|
|
19
|
-
### 1. Add the WWT Preset to the Tailwind config.
|
|
20
|
-
|
|
21
|
-
For new projects, we recommend that you use the provided config file as a [**preset**](https://tailwindcss.com/docs/presets). When setting up the `tailwind.config.js` file, import the WWT preset from the CSS Framework package. Note that `wwt-bsds-preset.js` sets `config.corePlugins.preflight: false` by default; we do this to apply our style resets instead of the Tailwind resets.
|
|
22
|
-
|
|
23
|
-
```javascript
|
|
24
|
-
/* tailwind.config.js */
|
|
25
|
-
|
|
26
|
-
module.exports = {
|
|
27
|
-
presets: [require('@wwtdev/bsds-css/dist/wwt-bsds-preset.js')]
|
|
28
|
-
};
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
While the foregoing setup is our recommended method, we have still put in effort to ensure that `wwt-bsds-preset.js` works as a [**base configuration**](https://tailwindcss.com/docs/configuration) in conjunction with the tailwind defaults and reset as well. So this _should_ still work as an alternative if needed, though it is not the focus/priority of our project:
|
|
32
|
-
|
|
33
|
-
```javascript
|
|
34
|
-
/* tailwind.config.js */
|
|
35
|
-
|
|
36
|
-
const wwtConfig = require('@wwtdev/bsds-css/dist/wwt-bsds-preset.js')
|
|
37
|
-
module.exports = {
|
|
38
|
-
...wwtConfig,
|
|
39
|
-
corePlugins: { preflight: false }
|
|
40
|
-
};
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
### 2. Tailwind CSS Directives
|
|
45
|
-
|
|
46
|
-
To prevent conflicts with our CSS Framework, only include the `base` and `utilities` directives.
|
|
47
|
-
|
|
48
|
-
Since our CSS has its own reset and default styles, we prevent Tailwind's `base` reset styles from loading, via a setting in our WWT Preset. The only styles that will be used from `base` are Tailwind CSS variables, which are needed in order to ensure all Tailwind classes work as expected.
|
|
49
|
-
|
|
50
|
-
```css
|
|
51
|
-
/* src/styles/tailwind.css */
|
|
52
|
-
|
|
53
|
-
@tailwind base;
|
|
54
|
-
@tailwind utilities;
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
Once you have completed the Tailwind installation steps, you can use the classes generated from the preset.
|
|
58
|
-
|
|
59
|
-
#### Order matters!
|
|
60
|
-
|
|
61
|
-
In your project's stylesheet ordering, the BSDS CSS framework should come first, _then_ the base Tailwind styles for easier overriding via TW utilities.
|
|
62
|
-
|
|
63
|
-
```javascript
|
|
64
|
-
/* src/main.js */
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
// Blue Steel Styles
|
|
68
|
-
import '@wwtdev/bsds-css/dist/wwt-bsds.min.css'
|
|
69
|
-
// TW
|
|
70
|
-
import './styles/tailwind.css'
|
|
71
|
-
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
Alternatively, you can leverage native CSS `@layer` to ensure TW utilities will always trump these styles.
|
|
75
|
-
|
|
76
|
-
```css
|
|
77
|
-
/* src/styles/index.css (or wherever your styles live) */
|
|
78
|
-
|
|
79
|
-
@layer app-base, external, app, utils;
|
|
80
|
-
|
|
81
|
-
/* -- BASE -- */
|
|
82
|
-
@import "@wwtdev/bsds-css/dist/wwt-bsds.min.css" layer(app-base);
|
|
83
|
-
|
|
84
|
-
/* -- EXTERNAL: any external stylesheets, e.g. from other 3d party libs -- */
|
|
85
|
-
@import "some-other-pkg/dist/style.css" layer(external);
|
|
86
|
-
|
|
87
|
-
/* -- APP / INTERNAL STYLES, e.g. your site's base styles -- */
|
|
88
|
-
@import "some-content.css" layer(app);
|
|
89
|
-
|
|
90
|
-
/* -- UTILITY CLASSES --
|
|
91
|
-
Due to how native CSS @layer works, and our defined layer order at the top of this file, utility classes will always trump any other styles in the app (as long as those styles are in one of our defined layers)
|
|
92
|
-
*/
|
|
93
|
-
|
|
94
|
-
@layer utils {
|
|
95
|
-
@tailwind base;
|
|
96
|
-
@tailwind utilities;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
### 3. Dark Mode-compatible "semantic" color utilities
|
|
102
|
-
|
|
103
|
-
We've extended the TW theme with color utilities that will automatically adjust when using dark mode. These classes require the CSS custom properties defined in the global stylesheet (`wwt-bsds.css`). If you're not bringing that stylesheet in, either disregard these classes or manually include the properties from [tokens.css](https://github.com/wwt-custom-apps/wwt-blue-steel/blob/main/packages/css-framework/src/styles/tokens.css) and [global.css](https://github.com/wwt-custom-apps/wwt-blue-steel/blob/main/packages/css-framework/src/styles/global.css) in your project.
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
### Browser Support
|
|
107
|
-
|
|
108
|
-
Our styles are compiled using Post CSS and Autoprefixer using the [`defaults` setting](https://github.com/browserslist/browserslist#full-list).
|
|
3
|
+
CSS framework for the [Blue Steel Design System](https://design.apps.wwt.com), built and maintained by [WWT](https://www.wwt.com). Provides design tokens, CSS components, utilities, and a Tailwind CSS preset that implement WWT's brand design language.
|