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
Copy file name to clipboardExpand all lines: docs/styling/bundling.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ title: CSS Bundling
6
6
7
7
<docs-warning>This documentation is only relevant when using the [Classic Remix Compiler][classic-remix-compiler]. If you're using [Remix Vite][remix-vite], you should refer to [Vite's CSS documentation][vite-css] instead.</docs-warning>
8
8
9
-
Some CSS features in Remix bundle styles into a single file that you load manually into the application including:
9
+
Some CSS features in Remix bundle styles into a single file that you load manually into the application, including:
10
10
11
11
-[CSS Side Effect Imports][css-side-effect-imports]
Copy file name to clipboardExpand all lines: docs/styling/css-in-js.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,12 +4,12 @@ title: CSS in JS
4
4
5
5
# CSS in JS libraries
6
6
7
-
You can use CSS-in-JS libraries like Styled Components and Emotion. Some of them require a "double render" in order to extract the styles from the component tree during the server render.
7
+
You can use CSS-in-JS libraries like Styled Components and Emotion. Some of them require a "double render" to extract the styles from the component tree during the server render.
8
8
9
9
Since each library is integrated differently, check out our [examples repo][examples] to see how to use some of the most popular CSS-in-JS libraries. If you've got a library working well that hasn't been covered, please [contribute an example][examples]!
10
10
11
11
<docs-warning>
12
-
Most CSS-in-JS approaches aren't recommended for use in Remix because they require your app to render completely before you know what the styles are. This is a performance issue and prevents streaming features like defer.
12
+
Most CSS-in-JS approaches aren't recommended for use in Remix because they require your app to render completely before you know what the styles are. This is a performance issue and prevents streaming features like `defer`.
Copy file name to clipboardExpand all lines: docs/styling/css.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,13 +6,13 @@ title: Regular CSS
6
6
7
7
Remix helps you scale an app with regular CSS with nested routes and [`links`][links].
8
8
9
-
CSS Maintenance issues can creep into a web app for a few reasons. It can get difficult to know:
9
+
CSS Maintenance issues can creep into a web app for a few reasons. It can get challenging to know:
10
10
11
11
- how and when to load CSS, so it was usually all loaded on every page
12
12
- if the class names and selectors you were using were accidentally styling other UI in the app
13
13
- if some rules weren't even used anymore as the CSS source code grew over time
14
14
15
-
Remix alleviates these issues with route-based stylesheets. Nested routes can each add their own stylesheets to the page and Remix will automatically prefetch, load, and unload them with the route. When the scope of concern is limited to just the active routes, the risks of these problems are reduced significantly. The only chances for conflicts are with the parent routes' styles (and even then, you will likely see the conflict since the parent route is also rendering).
15
+
Remix alleviates these issues with route-based stylesheets. Nested routes can each add their own stylesheets to the page, and Remix will automatically prefetch, load, and unload them with the route. When the scope of concern is limited to just the active routes, the risks of these problems are reduced significantly. The only chances for conflicts are with the parent routes' styles (and even then, you will likely see the conflict since the parent route is also rendering).
16
16
17
17
<docs-warning>If you're using the [Classic Remix Compiler][classic-remix-compiler] rather than [Remix Vite][remix-vite], you should remove `?url` from the end of your CSS import paths.</docs-warning>
18
18
@@ -62,11 +62,11 @@ It's subtle, but this little feature removes a lot of the difficulty when stylin
62
62
63
63
### Shared Component Styles
64
64
65
-
Websites large and small usually have a set of shared components used throughout the rest of the app: buttons, form elements, layouts, etc. When using plain style sheets in Remix there are two approaches we recommend.
65
+
Websites large and small usually have a set of shared components used throughout the rest of the app: buttons, form elements, layouts, etc. When using plain style sheets in Remix, there are two approaches we recommend.
66
66
67
67
#### Shared stylesheet
68
68
69
-
The first approach is very simple. Put them all in a `shared.css` file included in `app/root.tsx`. That makes it easy for the components themselves to share CSS code (and your editor to provide intellisense for things like [custom properties][custom-properties]), and each component already needs a unique module name in JavaScript anyway, so you can scope the styles to a unique class name or data attribute:
69
+
The first approach is basic. Put them all in a `shared.css` file included in `app/root.tsx`. That makes it easy for the components themselves to share CSS code (and your editor to provide intellisense for things like [custom properties][custom-properties]). Each component already needs a unique module name in JavaScript anyway, so you can scope the styles to a unique class name or data attribute:
70
70
71
71
```css filename=app/styles/shared.css
72
72
/* scope with class names */
@@ -101,7 +101,7 @@ This also makes it easy for routes to adjust the styles of a component without n
101
101
102
102
#### Surfacing Styles
103
103
104
-
A second approach is to write individual css files per component and then "surface" the styles up to the routes that use them.
104
+
A second approach is to write individual CSS files per component and then "surface" the styles up to the routes that use them.
105
105
106
106
Perhaps you have a `<Button>` in `app/components/button/index.tsx` with styles at `app/components/button/styles.css` as well as a `<PrimaryButton>` that extends it.
Not only will this make the asset high priority in the network tab, but Remix will turn that `preload` into a `prefetch` when you link to the page with [`<Link prefetch>`][link], so the SVG background is prefetched, in parallel, with the next route's data, modules, stylesheets, and any other preloads.
300
+
Not only will this make the asset a high priority in the network tab, but Remix will turn that `preload` into a `prefetch` when you link to the page with [`<Link prefetch>`][link], so the SVG background is prefetched, in parallel, with the next route's data, modules, stylesheets, and any other preloads.
Copy file name to clipboardExpand all lines: docs/styling/postcss.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,17 +46,17 @@ You can use CSS preprocessors like LESS and SASS. Doing so requires running an a
46
46
47
47
Once converted to CSS by the preprocessor, the generated CSS files can be imported into your components via the [Route Module `links` export][route-module-links] function, or included via [side effect imports][css-side-effect-imports] when using [CSS bundling][css-bundling], just like any other CSS file in Remix.
48
48
49
-
To ease development with CSS preprocessors you can add npm scripts to your `package.json` that generate CSS files from your SASS or LESS files. These scripts can be run in parallel alongside any other npm scripts that you run for developing a Remix application.
49
+
To ease development with CSS preprocessors, you can add npm scripts to your `package.json` that generate CSS files from your SASS or LESS files. These scripts can be run in parallel alongside any other npm scripts that you run for developing a Remix application.
50
50
51
51
An example using SASS.
52
52
53
-
1. First you'll need to install the tool your preprocess uses to generate CSS files.
53
+
1. First, you'll need to install the tool your preprocessing uses to generate CSS files.
54
54
55
55
```shellscript nonumber
56
56
npm add -D sass
57
57
```
58
58
59
-
2. Add an npm script to your `package.json`'s `scripts` section that uses the installed tool to generate CSS files.
59
+
2. Add an `npm` script to your `package.json`'s `scripts` section that uses the installed tool to generate CSS files.
60
60
61
61
```jsonc filename=package.json
62
62
{
@@ -79,7 +79,7 @@ An example using SASS.
79
79
npm run sass
80
80
```
81
81
82
-
This will start the `sass` process. Any new SASS files, or changes to existing SASS files, will be detected by the running process.
82
+
This will start the `sass` process. The running process will detect any new SASS files or changes to existing SASS files.
83
83
84
84
You might want to use something like `concurrently` to avoid needing two terminal tabs to generate your CSS files and also run `remix dev`.
Copy file name to clipboardExpand all lines: docs/styling/tailwind.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ title: Tailwind
4
4
5
5
# Tailwind
6
6
7
-
<docs-warning>This documentation is only relevant when using the [Classic Remix Compiler][classic-remix-compiler]. If you're using [Remix Vite][remix-vite], Tailwind can be integrated using [Vite's built-in PostCSS support][vite-postcss].</docs-warning>
7
+
<docs-warning>This documentation is only relevant when using the [Classic Remix Compiler][classic-remix-compiler]. If you're using [Remix Vite][remix-vite], Tailwind CSS can be integrated using [Vite's built-in PostCSS support][vite-postcss].</docs-warning>
8
8
9
9
Perhaps the most popular way to style a Remix application in the community is to use [Tailwind CSS][tailwind].
10
10
@@ -74,7 +74,7 @@ If you're using VS Code, it's recommended you install the [Tailwind IntelliSense
74
74
75
75
It's recommended that you avoid Tailwind's `@import` syntax (e.g. `@import 'tailwindcss/base'`) in favor of Tailwind directives (e.g. `@tailwind base`).
76
76
77
-
Tailwind replaces its import statements with inlined CSS but this can result in the interleaving of styles and import statements. This clashes with the restriction that all import statements must be at the start of the file.
77
+
Tailwind replaces its import statements with inlined CSS, but this can result in the interleaving of styles and import statements. This clashes with the restriction that all import statements must be at the start of the file.
78
78
79
79
Alternatively, you can use [PostCSS][built-in-post-css-support] with the [postcss-import] plugin to process imports before passing them to esbuild.
0 commit comments