You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -46,53 +46,9 @@ npm i -D carbon-components-svelte
46
46
47
47
## Usage
48
48
49
-
The quickest way to get started is to customize a template from the [examples](examples/) folder.
49
+
### Styling
50
50
51
-
Example set-ups demonstrate usage with popular application bundlers and frameworks. They include a mix of client-side rendering (CSR) and server-side rendering (SSR) approaches.
52
-
53
-
-**[examples/rollup](examples/rollup/)**: SPA bundled using [Rollup](https://github.com/rollup/rollup)
54
-
-**[examples/rollup-typescript](examples/rollup-typescript/)**: SPA bundled using [Rollup](https://github.com/rollup/rollup) with TypeScript support
55
-
-**[examples/routify](examples/routify/)**: SPA + static export using [Routify](https://github.com/roxiness/routify)
56
-
-**[examples/sapper](examples/sapper/)**: SSR + static export using [Sapper](https://github.com/sveltejs/sapper)
57
-
-**[examples/svite](examples/svite/)**: SPA developed with Svite, bundled with [Rollup](https://github.com/rollup/rollup)
58
-
-**[examples/webpack](examples/webpack/)**: SPA bundled with [webpack](https://github.com/webpack/webpack)
59
-
60
-
### Scaffolding
61
-
62
-
Each example is published in a dedicated branch of the same name.
63
-
64
-
Use [degit](https://github.com/Rich-Harris/degit) to scaffold a new project:
65
-
66
-
For example, to use the `svite` template, run the following commands:
The most performant method to load styles is to import SCSS directly from carbon-components. Although it requires more set up, you can reduce the size of the bundle CSS by importing individual component styles instead of a pre-compiled CSS StyleSheet.
144
127
145
-
exportdefaultapp;
146
-
```
128
+
Refer to the [official Carbon guide on SASS](https://github.com/carbon-design-system/carbon/blob/main/docs/guides/sass.md) for documentation.
147
129
148
-
See [webpack.config.js](examples/webpack/webpack.config.js) in [examples/webpack](examples/webpack).
130
+
### Dynamic theming
149
131
150
-
#### Dynamic theming
132
+
Use the "all.css" StyleSheet for dynamic, client-side theming.
151
133
152
-
Use `carbon-components-svelte/css/all.css` for dynamic, client-side styling.
134
+
```js
135
+
import"carbon-components-svelte/css/all.css";
136
+
```
153
137
154
138
Update the theme by setting the `theme` attribute on the `html` element. The default `theme` is `"white"`.
155
139
@@ -162,89 +146,91 @@ Update the theme by setting the `theme` attribute on the `html` element. The def
162
146
</html>
163
147
```
164
148
165
-
Using JavaScript:
149
+
Programmatically switch between each of the five Carbon themes by setting the "theme" attribute on the HTML element.
Import components from `carbon-components-svelte` in the `script` tag of your Svelte file. Visit the [documentation site](http://ibm.biz/carbon-svelte) for examples.
`optimizeImports` is a script preprocessor that rewrites base imports from Carbon components/icons/pictograms packages to their source Svelte code paths. This can greatly speed up compile times during development while preserving typeahead and autocompletion hinting offered by integrated development environments (IDE) like VSCode.
199
197
200
-
**After**
198
+
The preprocessor optimizes imports from the following packages:
0 commit comments