Skip to content

Commit 5667958

Browse files
committed
partially revert 3a984f2
1 parent c3ee6ff commit 5667958

File tree

9 files changed

+82
-8
lines changed

9 files changed

+82
-8
lines changed

docs/v4-recipes/client-server/fable-remoting.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
Add [Fable.Remoting.Giraffe](https://www.nuget.org/packages/Fable.Remoting.Giraffe/) to the Server and [Fable.Remoting.Client](https://www.nuget.org/packages/Fable.Remoting.Client/) to the Client.
88

99
> See [How Do I Add a NuGet Package to the Server](../../v4-recipes/package-management/add-nuget-package-to-server.md)
10-
> and [How Do I Add a NuGet Package to the Client](../../recipes/package-management/add-nuget-package-to-client.md).
10+
> and [How Do I Add a NuGet Package to the Client](../../v4-recipes/package-management/add-nuget-package-to-client.md).
1111
1212
#### 2. Create the API protocol
1313
You now need to create the protocol, or contract, of the API we’ll be creating. Insert the following below the `Route` module in `Shared.fs`:

docs/v4-recipes/javascript/third-party-react-package.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
To use a third-party React library in a SAFE application, you need to write an F# wrapper around it. There are two ways for doing this - using [Fable.React](https://www.nuget.org/packages/Fable.React/) or using [Feliz](https://zaid-ajaj.github.io/Feliz/).
22
## Prerequisites
33

4-
This recipe uses the [react-d3-speedometer NPM package](https://www.npmjs.com/package/react-d3-speedometer) for demonstration purposes. [Add it to your Client](../../recipes/package-management/add-npm-package-to-client.md) before continuing.
4+
This recipe uses the [react-d3-speedometer NPM package](https://www.npmjs.com/package/react-d3-speedometer) for demonstration purposes. [Add it to your Client](../package-management/add-npm-package-to-client.md) before continuing.
55

66
## Fable.React - Setup
77

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# How do I add an NPM package to the Client?
2+
3+
When you want to call a JavaScript library from your Client, it is easy to import and reference it using [NPM](https://docs.npmjs.com/cli/npm).
4+
5+
Run the following command:
6+
```bash
7+
npm install name-of-package
8+
```
9+
10+
This will download the package into the solution's **node_modules** folder.
11+
12+
You will also see a reference to the package in the Client's **package.json** file:
13+
```json
14+
"dependencies": {
15+
"name-of-package": "^1.0.0"
16+
}
17+
```
18+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# How do I add a NuGet package to the Client?
2+
Adding packages to the Client project is a very [similar process to the Server](add-nuget-package-to-server.md), with a few key differences:
3+
4+
- Any references to the `Server` directory should be `Client`
5+
6+
- Client code written in F# is converted into JavaScript using [Fable](https://fable.io/docs/index.html). Because of this, we must be careful to only reference libraries which are [Fable compatible](https://fable.io/docs/your-fable-project/use-a-fable-library.html).
7+
8+
- If the NuGet package uses any JS libraries you must install them.
9+
For simplicity, [use Femto to sync](./sync-nuget-and-npm-packages.md) - if the NuGet package is compatible - or [install via NPM](./add-npm-package-to-client.md) manually, if not.
10+
11+
There are [lots of great libraries](../../awesome-safe-components.md) available to choose from.

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
By adding either of these to your SAFE project alongside the [Bulma stylesheet or the Bulma NPM package](https://bulma.io/documentation/overview/start/), you can take full advantage of Bulma.
99

1010
### Using Feliz.Bulma
11-
1. [Add the Feliz.Bulma NuGet package to the solution](../../recipes/package-management/add-nuget-package-to-client.md).
11+
1. [Add the Feliz.Bulma NuGet package to the solution](./../package-management/add-nuget-package-to-client.md).
1212
1. Start using Feliz.Bulma components in your F# files.
1313
```fsharp
1414
open Feliz.Bulma
@@ -19,7 +19,7 @@ Bulma.button.button [
1919
```
2020

2121
### Using Fulma
22-
1. [Add the Fulma NuGet package to the solution](../../recipes/package-management/add-nuget-package-to-client.md).
22+
1. [Add the Fulma NuGet package to the solution](./../package-management/add-nuget-package-to-client.md).
2323
1. Start using Fulma components in your F# files.
2424
```fsharp
2525
open Fulma

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ If you’re using the minimal template, there are a couple of things to do befor
1313

1414
#### 1. The NuGet Package
1515
Add [Fable.FontAwesome.Free NuGet Package](https://www.nuget.org/packages/Fable.FontAwesome.Free/) to the Client project.
16-
> See [How do I add a NuGet package to the Client?](../../recipes/package-management/add-nuget-package-to-client.md).
16+
> See [How do I add a NuGet package to the Client?](../package-management/add-nuget-package-to-client.md).
1717
1818
#### 2. The CDN Link
1919
Open the `index.html` file and add the following line to the `head` element:

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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Find the following line in `src/Client/index.html` and delete it before moving o
1111

1212
#### 2. Add the NPM Package
1313
Go ahead and add the [Bulma NPM package](https://www.npmjs.com/package/bulma) to your project.
14-
> See: [How do I add an NPM package to the client?](../../recipes/package-management/add-npm-package-to-client.md)
14+
> See: [How do I add an NPM package to the client?](../package-management/add-npm-package-to-client.md)
1515
1616
#### 3. Load the Stylesheets
1717
There are two ways for loading the stylesheets:
@@ -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"

0 commit comments

Comments
 (0)