Skip to content

Commit e85165c

Browse files
committed
add v4 style recipe back in as new recipe references vite
1 parent c3ee6ff commit e85165c

File tree

4 files changed

+48
-2
lines changed

4 files changed

+48
-2
lines changed

docs/v4-recipes/ui/add-style.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# How Do I Use stylesheets with SAFE?
2+
If you wish to use your own CSS or SASS stylesheets with SAFE apps, you can embed either through webpack. The template already includes all required NPM packages you may need, so you will only need to configure webpack to reference your stylesheet and include in the outputs.
3+
4+
## Adding the Stylesheet
5+
First, create a CSS file in the `src/Client` folder of your solution e.g `style.css`.
6+
7+
> The same approach can be taken for `.scss` files.
8+
9+
## Configuring WebPack
10+
11+
### I'm using the Standard Template
12+
#### 1. Link to the stylesheet
13+
14+
Inside the `webpack.config.js` file, add the following variable to the `CONFIG` object, which points to the style file you created previously.
15+
```javascript
16+
cssEntry: './src/Client/style.css',
17+
```
18+
19+
#### 2. Embed CSS into outputs
20+
Find the `entry` field in the `module.exports` object at the bottom of the file, and replace it with the following:
21+
```javascript
22+
entry: isProduction ? {
23+
app: [resolve(CONFIG.fsharpEntry), resolve(CONFIG.cssEntry)]
24+
} : {
25+
app: resolve(CONFIG.fsharpEntry),
26+
style: resolve(CONFIG.cssEntry)
27+
},
28+
```
29+
30+
This combines the css and F# outputs into a single bundle for production, and separately for dev.
31+
32+
### I'm using the Minimal Template
33+
#### 1. Embed CSS into outputs
34+
Find the `entry` field in the `module.exports` object at the bottom of the file, and replace it with the following:
35+
```javascript
36+
entry: {
37+
app: [
38+
resolve('./src/Client/Client.fsproj'),
39+
resolve('./src/Client/style.css')
40+
]
41+
},
42+
```
43+
44+
## There you have it!
45+
You can now style your app by writing to the `style.css` file.

docs/v4-recipes/ui/add-tailwind.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[Tailwind](https://tailwindcss.com/) is a utility-first CSS framework packed that can be composed to build any design, directly in your markup.
44

5-
1. [Add a stylesheet](../../recipes/ui/add-style.md) to the project
5+
1. [Add a stylesheet](add-style.md) to the project
66

77
2. Install the required npm packages
88
```shell

docs/v4-recipes/ui/cdn-to-npm.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ importAll "bulma/bulma.sass"
2727
> You can use this approach for any NPM package.
2828
2929
##### b. Using Sass
30-
1. Add a Sass stylesheet to your project using [this recipe](../../recipes/ui/add-style.md).
30+
1. Add a Sass stylesheet to your project using [this recipe](add-style.md).
3131
2. Add the following line to your Sass file to bring in Bulma
3232
```sass
3333
@import "~bulma/bulma.sass"

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ nav:
145145
- Quickly add a database: "v4-recipes/storage/use-litedb.md"
146146
- Create a data module using SQLProvider SQL Server SSDT: "v4-recipes/storage/use-sqlprovider-ssdt.md"
147147
- UI:
148+
- Add Stylesheet support: "v-4/recipes/ui/add-style.md"
148149
- Add FontAwesome support: "v4-recipes/ui/add-fontawesome.md"
149150
- Add Bulma support: "v4-recipes/ui/add-bulma.md"
150151
- Use different Bulma Themes: "v4-recipes/ui/use-different-bulma-themes.md"

0 commit comments

Comments
 (0)