Skip to content

Commit 689556c

Browse files
committed
Support Vite
1 parent b1a22e3 commit 689556c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+24025
-28248
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ jobs:
3333
- "test-apps/embroider-app"
3434
- "test-apps/pods-embroider-app"
3535
- "test-apps/pods-classic-app"
36+
- "test-apps/vite-app"
3637

3738
steps:
3839
- uses: wyvox/action@v1
@@ -53,6 +54,7 @@ jobs:
5354
- "test-apps/embroider-app"
5455
- "test-apps/pods-embroider-app"
5556
- "test-apps/pods-classic-app"
57+
- "test-apps/vite-app"
5658

5759
steps:
5860
- uses: wyvox/action@v1

.npmrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,10 @@ prefer-workspaces-packages=true
1111
# default is true, we do this to try to have more isolation
1212
# since we test with incompatible sets of TS types.
1313
shared-workspace-lockfile=false
14+
15+
## We use so many similarly grouped peers, we want to make the
16+
## peer-groups easier to distinguish.
17+
## This forces a shorter sha for all groups (vs the default of 1000)
18+
##
19+
peers-suffix-max-length=40
20+
virtual-store-dir-max-length=40

README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ This build tool emits CSS in a `@layer`.
1515

1616
## Compatibility
1717

18+
- Vite
1819
- V2 addons
1920
- non-embroider apps
2021
- embroider apps
@@ -26,6 +27,48 @@ This build tool emits CSS in a `@layer`.
2627
| classic components | <= 0.18.0 | <= 8.0.0 |
2728
| ember < 4 | <= 0.18.0 | <= 8.0.0 |
2829

30+
## Installation for a Vite app
31+
32+
```bash
33+
npm install --save-dev ember-scoped-css
34+
```
35+
36+
### Configuration
37+
38+
In your `vite.config.js`, import and add the `scopedCSS` plugin:
39+
```js
40+
import { defineConfig } from 'vite';
41+
import { scopedCSS } from 'ember-scoped-css/vite';
42+
43+
export default defineConfig({
44+
// ...
45+
plugins: [
46+
scopedCSS(),
47+
// ...
48+
],
49+
});
50+
```
51+
52+
and then in your `babel.config.cjs`, add a template-transform:
53+
```js
54+
const scopedCSS = require("ember-scoped-css/build");
55+
56+
module.exports = {
57+
plugins: [
58+
// ...
59+
[
60+
'babel-plugin-ember-template-compilation',
61+
{
62+
// ...
63+
transforms: [scopedCSS.templatePlugin({})],
64+
},
65+
],
66+
// ...
67+
],
68+
// ...
69+
};
70+
71+
```
2972

3073
## Installation for a non-embroider ember app
3174

0 commit comments

Comments
 (0)