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: README.md
+95-5Lines changed: 95 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,16 +5,106 @@ This is a tutorial shared as part of the #30DaysOfSWA series, to showcase the us
5
5
## What We'll Learn:
6
6
7
7
* What is Docusaurus?
8
-
*`Setup`: Docusaurus Quickstart
9
-
*`Deploy`: To Azure Static Web Apps
10
-
*`Simplify`: Keep Blog, Remove Docs
11
-
*`Customize`: Add Showcase Page
8
+
*Quickstart: setup classic site
9
+
*Configure: docusaurus.config.js
10
+
*Deploy: Azure Static Web Apps
11
+
* Customize: Themes & Plugins
12
12
*`Exercise`:
13
13
- Add API to fetch content!
14
14
- Add Auth to tweet content!
15
+
- Add MDX component to page!
15
16
16
-
##
17
+
---
17
18
19
+
## What is Docusaurus?
18
20
21
+
Docusaurus is an open-source project from Meta that helps you build, deploy, and maintain, open source project websites. It was rated one of the top 3 [rising stars of JavaScript](https://docusaurus.io/) in 2021, under the _static site generators_ category.
19
22
23
+
Read their [documentation](https://docusaurus.io/docs) and visit their [showcase](https://docusaurus.io/showcase) for real-world examples of what you can build with docusaurus.
24
+
25
+
---
26
+
27
+
## Setup Site: Quickstart
28
+
29
+
1. Setup a Docusaurus site (`classic` theme) in a dedicated folder (`www`) in repo. The command automatically installs the required packages and their dependencies.
30
+
31
+
```bash
32
+
npx create-docusaurus@latest www classic
33
+
```
34
+
35
+
2. Let's see what was created for us. The output has been cleaned up for clarity.
36
+
37
+
```
38
+
ls -l www/
39
+
40
+
README.md
41
+
babel.config.js
42
+
blog/
43
+
docs/
44
+
docusaurus.config.js
45
+
node_modules/
46
+
package-lock.json
47
+
package.json
48
+
sidebars.js
49
+
src/
50
+
static/
51
+
```
52
+
53
+
3. Let's preview the site locally, to validate this worked.
54
+
55
+
```bash
56
+
cd www
57
+
npx docusaurus start
58
+
59
+
[INFO] Starting the development server...
60
+
[SUCCESS] Docusaurus website is running at http://localhost:3000/.
61
+
```
62
+
63
+
You should see something like this - this is the default landing page for the scaffolded Docusaurus site.
64
+
65
+

66
+
67
+
4. The dev server supports hot reloading. Try making a minor change to the site source - for example edit `docusaurus.config.js` and change the `title` to **"My Static Web Apps Site"**. You should see this in your site preview, instantly:
68
+
69
+

70
+
71
+
5. You can now build a **production-ready** version of that site as follows. Note that the static files are generated in the **build/** directory.
72
+
73
+
```bash
74
+
cd www/
75
+
npm run build
76
+
..
77
+
..
78
+
[SUCCESS] Generated static files in"build".
79
+
[INFO] Use `npm run serve`command to test your build locally.
80
+
```
81
+
82
+
## Deploy Site: To Azure
83
+
84
+
Docusaurus is built using React - so you can use [the same configuration settings](https://docs.microsoft.com/en-us/azure/static-web-apps/front-end-frameworks) for Docusaurus, when deploying to Azure Static Web Apps.
85
+
86
+
You have three options to get started:
87
+
* via browser with [the Azure Portal quickstart](https://docs.microsoft.com/en-us/azure/static-web-apps/getting-started?tabs=react)
88
+
* via terminal with [the Azure CLI quickstart](https://docs.microsoft.com/en-us/azure/static-web-apps/get-started-cli?tabs=vanilla-javascript)
89
+
* via IDE with [the VS Code Extension quickstart](https://docs.microsoft.com/en-us/azure/static-web-apps/getting-started?tabs=vanilla-javascript)
90
+
91
+
If you prefer the first approach, click the button to go to the Azure portal, then follow the [quickstart](https://docs.microsoft.com/en-us/azure/static-web-apps/getting-started?tabs=react) guidance, but using *this* project's details instead.
92
+
93
+
[](https://portal.azure.com/?feature.customportal=false&WT.mc_id=30daysofswa-61155-cxall#create/Microsoft.StaticApp)
94
+
95
+
## Deploy Site: with VSCode
96
+
97
+
I'll use the [Visual Studio Code extension](https://docs.microsoft.com/en-us/azure/static-web-apps/getting-started?tabs=vanilla-javascript) to make this happen with just a few clicks.
98
+
99
+
1.**Install Extension** | Open Visual Studio Code (IDE) in the project folder for your repo. Install the [Azure Static Web Apps extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurestaticwebapps) by visiting this page and clicking "Install".
100
+
101
+

102
+
103
+
When extension is installed, you should see this window in your VS Code editor, confirming readiness for use.
2.**Create your first Azure Static App** | The extension's [documentation page](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurestaticwebapps) walks you through the steps needed visually, so reference it! You can also visit its [GitHub](https://github.com/microsoft/vscode-azurestaticwebapps/wiki/Creating-a-Static-Web-App) page for more details. Start by clicking the `Azure` icon in your VS Code sidebar, scroll down to the `Static Web Apps` section, then click the "+" button to **Create Static Web App**.
0 commit comments