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
+37-16Lines changed: 37 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@
3
3
<imgwidth="400"src="https://i.imgur.com/83Y7bWN.png"alt="React & Google Apps Script logos"></a>
4
4
</p>
5
5
<palign="center"><i>
6
-
Update 2022: Now with support for React v17 and React Fast Refresh
6
+
Update 2023: Now with support for React v18 and React Fast Refresh
7
7
</i></p>
8
8
9
9
<divalign="center">
@@ -15,7 +15,7 @@
15
15
16
16
</div>
17
17
18
-
<palign="center"> 🚀 This is your boilerplate project for developing React apps inside Google Sheets, Docs, Forms and Slides projects. It's perfect for personal projects and for publishing complex add-ons in the G Suite Marketplace.
18
+
<palign="center"> 🚀 This is your boilerplate project for developing React apps inside Google Sheets, Docs, Forms and Slides projects. It's perfect for personal projects and for publishing complex add-ons in the Google Workspace Marketplace.
19
19
</p>
20
20
21
21
---
@@ -27,11 +27,11 @@
27
27
-[Prerequisites](#prerequisites)
28
28
-[Getting started](#getting-started)
29
29
-[Deploy](#deploy)
30
-
-[[New!]Local Development](#local-development)
30
+
-[Local Development](#local-development)
31
31
-[Using React DevTools](#dev-tools)
32
32
-[Usage](#usage)
33
33
-[The included sample app](#the-included-sample-app)
34
-
-[[New!]Typescript](#new-typescript)
34
+
-[Typescript](#new-typescript)
35
35
-[Adding packages](#adding-packages)
36
36
-[Styles](#styles)
37
37
-[Modifying scopes](#modifying-scopes)
@@ -68,11 +68,11 @@ See [deploy](#deploy) for notes on how to deploy the project and see it live in
68
68
69
69
### Prerequisites <aname = "prerequisites"></a>
70
70
71
-
- Make sure you're running at least [Node.js](https://nodejs.org/en/download/)v10 and `npm` v6.
71
+
- Make sure you're running at least [Node.js](https://nodejs.org/en/download/)v14 and `npm` v6.
72
72
73
73
- You'll need to enable the Google Apps Script API. You can do that by visiting [script.google.com/home/usersettings](https://script.google.com/home/usersettings).
74
74
75
-
-[New!]To use live reload while developing, you'll need to serve your files locally using HTTPS. See [local development](#local-development) below for how to set up your local environment.
75
+
- To use live reload while developing, you'll need to serve your files locally using HTTPS. See [local development](#local-development) below for how to set up your local environment.
76
76
77
77
### 🏁 Getting started <aname = "getting-started"></a>
78
78
@@ -145,7 +145,7 @@ Now open Google Sheets and navigate to your new spreadsheet (e.g. the file "My R
145
145
146
146
<br/>
147
147
148
-
## 🎈 [NEW!]Local Development <aname="local-development"></a>
148
+
## 🎈 Local Development <aname="local-development"></a>
149
149
150
150
We can develop our client-side React apps locally, and see our changes directly inside our Google Spreadsheet dialog window.
151
151
@@ -233,14 +233,35 @@ You will need to use the "standalone" version of React DevTools since our React
233
233
234
234
The included sample app allows inserting/activating/deleting sheets through a simple HTML dialog, built with React. This simple app demonstrates how a React app can interact with the underlying Spreadsheet using Google Apps Script functions.
235
235
236
-
The included sample app has three menu items for loading pages in various dialogs and sidebars.
236
+
The included sample app has five menu items that demonstrate how to load pages in various dialogs and sidebars. Sample implementations using different component libraries are included.
237
237
238
-
Two versions of the same app are provided with different styling: the first version uses vanilla React, and the second uses the popular bootstrap library (in this case, it uses [`react-bootstrap`](https://react-bootstrap.github.io/)). The bootstrap example also contains an example of a page built with typescript (see below)
239
-
240
-
A third app just demonstrates how to load a sidebar dialog.
238
+
-`Sheet Editor` - This is a basic app that opens in a dialog window that demonstrates how to select, create and delete sheets in a Google Sheets documents through server calls. It uses vanilla React with no component library.
239
+
-`Sheet Editor (Boostrap)` - The same basic app is included but styled with the Bootstrap library using [`react-bootstrap`](https://react-bootstrap.github.io/). The bootstrap example also contains an example of a page built with typescript (see below).
240
+
-`Sheet Editor (MUI)` - A similar example using [`Material UI`](https://mui.com/).
241
+
-`Sheet Editor (Tailwind CSS)` - Another example, using [`Tailwind`](https://tailwindcss.com/)
242
+
-`About me` - This is just a simple page that demonstrates the use of a sidebar dialog.
241
243
242
244
Access the dialogs through the new menu item that appears. You may need to refresh the spreadsheet and approve the app's permissions the first time you use it.
243
245
246
+
Note that if you are choosing to use one framework, for example `Tailwind`, for your project, it is advisable to remove the dependencies for the other component libraries.
247
+
248
+
<details>
249
+
<summary>Here are some steps to take to clean up the repo if you are only using a single library</summary>
2. Remove the unneeded menu bar items from the server code.
254
+
255
+
3. Remove the unneeded client code.
256
+
257
+
4. Update the `clientEntrypoints` in the [webpack config file](./webpack.config.js) to only target the relevant apps.
258
+
259
+
<br/>
260
+
261
+
</details>
262
+
263
+
</br>
264
+
244
265
### [New!] Typescript
245
266
246
267
This project now supports typescript!
@@ -263,7 +284,7 @@ For instance, install `react-transition-group` from npm:
263
284
npm install react-transition-group
264
285
```
265
286
266
-
Important: Since Google Apps Scripts projects don't let you easily reference external files, this project will bundle an entire app into one HTML file. This can result in large files if you are importing large packages. To help split up the files, you can grab a CDN url for your package and declare it in the [webpack file, here](./webpack.config.js#L157). If set up properly, this will add a script tag that will load packages from a CDN, reducing your bundle size.
287
+
Important: Since Google Apps Scripts projects don't let you easily reference external files, this project will bundle an entire app into one HTML file. This can result in large files if you are importing large packages. To help reduce the size of these large HTML files, you can try to externalize packages by using a CDN to load packages. For packages that can be loaded through a CDN (usually they will have a UMD build), you can configure the CDN details here in the [webpack config file](./webpack.config.js#L187). If set up properly, this will add a script tag that will load packages from a CDN, reducing your overall bundle size.
267
288
268
289
### Styles
269
290
@@ -290,8 +311,8 @@ This project uses the [gas-client](https://github.com/enuchi/gas-client) package
290
311
```js
291
312
// Google's documentation wants you to do this. Boo.
0 commit comments