Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated documentations #137

Merged
merged 2 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/sixty-pandas-exist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"embroider-css-modules": patch
"type-css-modules": patch
---

Updated documentations
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ What `embroider-css-modules` looks like is:

- Quite stable for apps
- Quite stable for v2 addons
- Unknown for v1 addons (including engines)
- Unknown for v1 addons (including engines) - likely won't be implemented

Non-Embroider projects can use [`ember-css-modules`](https://github.com/salsify/ember-css-modules). V2 addons that use `embroider-css-modules` do work on non-Embroider projects, i.e. you can use both addons at the same time.


## Contributing
Expand All @@ -61,7 +63,7 @@ See the [Contributing](CONTRIBUTING.md) guide for details.

## Credits

The `webpack` implementation is possible, thanks to ideas from [Ember + Modern CSS](https://github.com/evoactivity/ember-modern-css) by [@evoactivity](https://github.com/evoactivity). Special thanks to the maintainers of [`ember-css-modules`](https://github.com/salsify/ember-css-modules), who paved the Ember way to CSS modules.
The `webpack` implementation is possible, thanks to ideas from [Ember + Modern CSS](https://github.com/evoactivity/ember-modern-css) by [@evoactivity](https://github.com/evoactivity). Special thanks to the maintainers of `ember-css-modules`, who paved the Ember way to CSS modules.


## License
Expand Down
32 changes: 14 additions & 18 deletions docs/written-guides/migrate-from-ember-css-modules.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
# Migrate from ember-css-modules

You can reach `embroider-css-modules` in a few steps. (See [`ember-container-query`](https://github.com/ijlee2/ember-container-query/pull/167) for reference.)
Have an Embroider app that runs on `ember-css-modules`? In a few steps, you can replace it with `embroider-css-modules` so that you can enable stricter Embroider settings.

1. [Remove ember-css-modules](#remove-ember-css-modules)
1. [Configure Webpack](#configure-webpack)
1. [Remove ember-css-modules syntax](#remove-ember-css-modules-syntax)
1. [Update project configurations](#update-project-configurations)
1. [Enable stricter Embroider settings](#enable-stricter-embroider-settings)

> [!NOTE]
> If you get lost, you can check [`ember-container-query`](https://github.com/ijlee2/ember-container-query/pull/167) for reference.

## Remove ember-css-modules

Run `ember-codemod-remove-ember-css-modules` to remove `ember-css-modules` syntax.
## Remove ember-css-modules syntax

Run the provided [codemod](../../packages/ember-codemod-remove-ember-css-modules/README.md) to get started.

```sh
npx ember-codemod-remove-ember-css-modules <arguments>
# From the project root
npx ember-codemod-remove-ember-css-modules --type app
```

For more information, please see [the codemod's `README`](../../packages/ember-codemod-remove-ember-css-modules/README.md).
You may also want to [refactor code](./refactor-code.md).


## Update project configurations
Expand All @@ -25,13 +29,9 @@ Please follow steps 1-3 of [Set up CSS modules (apps)](./set-up-css-modules-apps

## Enable stricter Embroider settings

With `ember-css-modules` gone, you may be able to apply stricter settings for Embroider.

<details>

<summary><code>ember-cli-build.js</code></summary>
In `ember-cli-build.js`, you may now be able to apply stricter settings for Embroider.

For simplicity, only `options` is shown. (The rest of the code remains the same.)
For simplicity, only the [options for `@embroider/compat`](https://github.com/embroider-build/embroider/#options) are shown. (The rest of the file remains the same.)

```js
const options = {
Expand All @@ -41,11 +41,7 @@ const options = {
staticAddonTrees: true, // <-- new
staticComponents: true, // <-- new
staticEmberSource: true,
staticHelpers: true,
staticHelpers: true, // <-- new
staticModifiers: true,
};
```

</details>

Learn more about the [options for Embroider](https://github.com/embroider-build/embroider/#options).
8 changes: 5 additions & 3 deletions docs/written-guides/migrate-from-ember-modern-css.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@ pnpm install --dev \
embroider-css-modules type-css-modules
```

<sup>1. Needed only if you have a TypeScript project</sup>
<sup>1. Needed only if you have a TypeScript project.</sup>


## Configure type-css-modules

⚠️ You may skip this step if your project doesn't support TypeScript.
> [!NOTE]
> You can skip this step if you don't have a TypeScript project.

If you have typed `*.css` files, either by installing [`@types/css-modules`](https://www.npmjs.com/package/@types/css-modules) or defining the type to be `Record<string, string>` in `types/global.d.ts`, please undo the change.

Expand Down Expand Up @@ -108,7 +109,8 @@ Next, remove all `:local()` pseudo-class selectors. Instead, use the `:global()`

## Use the {{local}} helper

⚠️ You may skip this step if you didn't create the `{{styles}}` helper.
> [!NOTE]
> You can skip this step if you didn't create the `{{styles}}` helper.

Remove the `{{styles}}` helper. To apply multiple styles, use the [`{{local}}` helper](../../packages/embroider-css-modules/README.md#helper-local) instead.

Expand Down
Loading