Skip to content

Commit 49d6d4e

Browse files
committed
Initial Commit: Classic site created in www/
Committing before Create Static Apps workflow initiated on VS Code
1 parent cceaa4d commit 49d6d4e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+23516
-5
lines changed

README.md

Lines changed: 95 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,106 @@ This is a tutorial shared as part of the #30DaysOfSWA series, to showcase the us
55
## What We'll Learn:
66

77
* 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
1212
* `Exercise`:
1313
- Add API to fetch content!
1414
- Add Auth to tweet content!
15+
- Add MDX component to page!
1516

16-
##
17+
---
1718

19+
## What is Docusaurus?
1820

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.
1922

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+
![Landing Page](./img/11-landing.png)
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+
![Landing Page Reloaded](./img/11-reload.png)
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+
[![Deploy to Azure button](https://aka.ms/deploytoazurebutton)](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+
![VS Code Extension for SWA](./img/11-extension.png)
102+
103+
When extension is installed, you should see this window in your VS Code editor, confirming readiness for use.
104+
105+
![VS Code Extension Installed](./img/11-vscode.png)
106+
107+
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**.
108+
109+
![Activate SWA Extension](./img/11-swa-plus.png)
20110

img/11-blog.png

1.03 MB
Loading

img/11-docs.png

401 KB
Loading

img/11-extension.png

108 KB
Loading

img/11-landing.png

311 KB
Loading

img/11-markdown.png

172 KB
Loading

img/11-reload.png

311 KB
Loading

img/11-swa-plus.png

3.07 KB
Loading

img/11-vscode.png

66.1 KB
Loading

www/.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Dependencies
2+
/node_modules
3+
4+
# Production
5+
/build
6+
7+
# Generated files
8+
.docusaurus
9+
.cache-loader
10+
11+
# Misc
12+
.DS_Store
13+
.env.local
14+
.env.development.local
15+
.env.test.local
16+
.env.production.local
17+
18+
npm-debug.log*
19+
yarn-debug.log*
20+
yarn-error.log*

0 commit comments

Comments
 (0)