ember-scoped-css 3.1.0 → 3.2.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 +40 -2
- package/dist/cjs/all-DJjr6YEx.cjs +1534 -0
- package/dist/cjs/all.cjs +1 -1
- package/dist/cjs/babel.cjs +1 -1
- package/dist/cjs/rollup.cjs +1 -1
- package/dist/cjs/vite.cjs +1 -1
- package/package.json +1 -1
- package/src/lib/path/utils.js +29 -5
- package/dist/cjs/all-BI7LOSuT.cjs +0 -1519
package/README.md
CHANGED
|
@@ -48,6 +48,7 @@ This build tool can emit CSS in a `@layer`.
|
|
|
48
48
|
|
|
49
49
|
- Vite
|
|
50
50
|
- V2 addons with `@embroider/addon-dev` @ v8+ (or similar)
|
|
51
|
+
- V2 addons / libraries built with rolldown or tsdown (e.g. via [`@nullvoxpopuli/ember-rolldown`](https://github.com/NullVoxPopuli/ember.nvp/tree/main/packages/rolldown))
|
|
51
52
|
- For [hbs, broccoli, or webpack-based builds, view this version of the docs](https://github.com/auditboard/ember-scoped-css/tree/hbs-classic-and-webpack-support)
|
|
52
53
|
- For [bugfixes for the pre-ember-scoped-css-1.0 code, PR here](https://github.com/auditboard/ember-scoped-css/tree/hbs-classic-and-webpack-support)
|
|
53
54
|
|
|
@@ -55,6 +56,7 @@ This build tool can emit CSS in a `@layer`.
|
|
|
55
56
|
| -------- | ----------- | ---------------------- | --- |
|
|
56
57
|
| vite | >= 1.0.0 | 🚫 | [main][docs-main]
|
|
57
58
|
| gjs / gts library (no hbs) | >= 1.0.0 | 🚫 | [main][docs-main]
|
|
59
|
+
| rolldown / tsdown | >= 3.1.0 | 🚫 | [main][docs-main]
|
|
58
60
|
| webpack | <= 0.24.3 | <= 10.0.0 | [0.24.3][docs-2]
|
|
59
61
|
| hbs | <= 0.24.3 | <= 10.0.0 | [0.24.3][docs-2]
|
|
60
62
|
| ember-template-imports@v4 or babel-plugin-ember-template-compilation@2.2.5+ | 0.19.0 | 10.0.0 | [0.19][docs-3] - [0.24][docs-2]
|
|
@@ -78,7 +80,7 @@ npm install --save-dev ember-scoped-css
|
|
|
78
80
|
Configuration happens in multiple locations to take over the need portion of your build steps.
|
|
79
81
|
|
|
80
82
|
- `vite.config.*`
|
|
81
|
-
- `rollup.config.*`
|
|
83
|
+
- `rollup.config.*` (or `rolldown.config.*` / `tsdown.config.*`)
|
|
82
84
|
- `babel.config.*`
|
|
83
85
|
|
|
84
86
|
#### Vite
|
|
@@ -149,6 +151,42 @@ plugins: [
|
|
|
149
151
|
|
|
150
152
|
- `layerName: string` - Wrap your CSS in a `@layer` with this given name
|
|
151
153
|
|
|
154
|
+
#### Rolldown / tsdown
|
|
155
|
+
|
|
156
|
+
The rollup plugin also works under [rolldown](https://rolldown.rs/) and [tsdown](https://tsdown.dev/).
|
|
157
|
+
For a v2 library built with tsdown via [`@nullvoxpopuli/ember-rolldown`](https://github.com/NullVoxPopuli/ember.nvp/tree/main/packages/rolldown),
|
|
158
|
+
the whole setup lives in `tsdown.config.js` — no `babel.config.js` needed:
|
|
159
|
+
|
|
160
|
+
```js
|
|
161
|
+
import { defineConfig } from 'tsdown';
|
|
162
|
+
import { ember } from '@nullvoxpopuli/ember-rolldown';
|
|
163
|
+
import { scopedCSS } from 'ember-scoped-css/rollup';
|
|
164
|
+
import { scopedCSS as scopedCssBabel } from 'ember-scoped-css/babel';
|
|
165
|
+
|
|
166
|
+
export default defineConfig({
|
|
167
|
+
entry: ['./src/index.ts'],
|
|
168
|
+
css: { inject: true },
|
|
169
|
+
plugins: [
|
|
170
|
+
ember({
|
|
171
|
+
babel: {
|
|
172
|
+
// only needed if you use scopedClass in module code
|
|
173
|
+
plugins: [scopedCssBabel()],
|
|
174
|
+
templateTransforms: [scopedCssBabel.template({})],
|
|
175
|
+
},
|
|
176
|
+
}),
|
|
177
|
+
scopedCSS(),
|
|
178
|
+
],
|
|
179
|
+
});
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Notes:
|
|
183
|
+
|
|
184
|
+
- [`@tsdown/css`](https://www.npmjs.com/package/@tsdown/css) must be installed (it releases in lockstep with tsdown) — it bundles the scoped CSS into `dist/style.css`.
|
|
185
|
+
- `css: { inject: true }` keeps the `import './style.css'` statement in the built JS, so consuming apps load the CSS through the module graph. Without it the CSS is emitted but nothing imports it.
|
|
186
|
+
- If your library has its own `babel.config.js`, configure the plugins there instead (see [Babel](#babel) below) — `ember()` picks the config file up automatically.
|
|
187
|
+
|
|
188
|
+
This supports co-located `.css` files, inline `<style scoped>` blocks, and the `scopedClass` pseudo-helper, same as the other build tools.
|
|
189
|
+
|
|
152
190
|
#### Babel
|
|
153
191
|
|
|
154
192
|
In your `babel.config.*`, add the plugins:
|
|
@@ -181,7 +219,7 @@ There are two plugins, but you made only need one:
|
|
|
181
219
|
##### Configuration Options (`scopedCSS.template()`)
|
|
182
220
|
|
|
183
221
|
- `layerName: string` - Wrap your CSS in a `@layer` with this given name
|
|
184
|
-
- `additionalRoots: string[]` -
|
|
222
|
+
- `additionalRoots: string[]` - Process additional directories, for example pods or directories from other packages in a monorepo.
|
|
185
223
|
|
|
186
224
|
### TypeScript
|
|
187
225
|
|