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: docs/spfx/web-parts/get-started/hosting-webpart-from-office-365-cdn.md
+15-18Lines changed: 15 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: Host your client-side web part from Office 365 CDN (Hello World part 4)
3
3
description: An easy solution to host your assets directly from your own Office 365 tenant. Can be used for hosting any static assets that are used in SharePoint Online.
4
-
ms.date: 01/08/2018
4
+
ms.date: 08/20/2018
5
5
ms.prod: sharepoint
6
6
---
7
7
@@ -69,23 +69,23 @@ You can also follow these steps by watching this video on the SharePoint PnP You
69
69
SharePoint Framework solutions can automatically benefit from the Office 365 Public CDN as long as it's enabled in your tenant. When CDN is enabled, the `*/CLIENTSIDEASSETS` origin is automatically added as a valid origin.
70
70
71
71
> [!NOTE]
72
-
> If you have previously enabled Office 365 CDN, you should re-enable the public CDN so that you have the `*/CLIENTSIDEASSETS`entry added as a valid CDN origin for public CDN. If this entry is not present and the public CDN is enabled in your tenant, bundle requests will contain the token hostname `spclientsideassetlibrary` in their URL, causing the requests to fail.
72
+
> If you have previously enabled Office 365 CDN, you should re-enable the public CDN so that you have the `*/CLIENTSIDEASSETS`entry added as a valid CDN origin for public CDN. If this entry is not present and the public CDN is enabled in your tenant, bundle requests will contain the token hostname `spclientsideassetlibrary` in their URL, causing the requests to fail. You can add this missing entry by using `Add-SPOTenantCdnOrigin -CdnType Public -OriginUrl */CLIENTSIDEASSETS` command.
73
73
74
74
6. You can double-check the current setup of your end-points. Execute the following command to get the list of CDN origins from your tenant:
75
75
76
76
```powershell
77
77
Get-SPOTenantCdnOrigins -CdnType Public
78
78
```
79
79
80
-
Notice that your newly added origin is listed as a valid CDN origin. Final configuration of the origin takes a while (approximately 15 minutes), so we can continue by creating your test web part, which will be hosted from the origin when the deployment is completed.
80
+
Notice that when you enable CDN first time, default configuration to enable default origins will take a while (approximately 15 minutes). Configuration is completed when there's no **(configuration pending)** messages when you execute `Get-SPOTenantCdnOrigins -CdnType Public` command.
81
81
82
82

83
83
84
84
> [!NOTE]
85
-
> When the origin is listed without the *(configuration pending)* text, it is ready to be used in your tenant. This is the indication of an on-going configuration between SharePoint Online and the CDN system.
85
+
> When the origin is listed without the *(configuration pending)* text, it is ready to be used in your tenant. This is the indication of an on-going configuration between SharePoint Online and the CDN system.
86
86
87
87
88
-
## End task in project directory
88
+
## Finalize solution for deployment
89
89
90
90
1. Switch to the console and make sure you are still in the project directory that you used to set up your web part project.
91
91
@@ -105,26 +105,24 @@ You can also follow these steps by watching this video on the SharePoint PnP You
The default value for the **includeClientSideAssets** is `true`, which means that static assets are packaged automatically inside of the *.sppkg* files, and you do not need to separately host your assets from an external system.
121
+
The default value for the **includeClientSideAssets** is `true`, which means that static assets are packaged automatically inside of the *.sppkg* files, and you do not need to separately host your assets from an external system.
123
122
124
-
If *Office 365 CDN* is enabled, it is used automatically with default settings. If *Office 365 CDN* is not enabled, assets are served from the app catalog site collection.
123
+
Do **not** change this setting for this exerice, so that assets are automatically hosted when solution is deployed to your tenant.
125
124
126
-
> [!NOTE]
127
-
> Starting from the SharePoint Framework v1.4, static assets are by default packaged inside of the sppkg package. When a package is deployed in the app catalog, they are automatically hosted either from Office 365 CDN (if enabled) or from an app catalog URL. You can control this behavior with the `includeClientSideAssets` setting in the `package-solution.json` file.
125
+
If *Office 365 CDN* is enabled, it is used automatically with default settings. If *Office 365 CDN* is not enabled, assets are served from the app catalog site collection. This means that if you leave the **includeClientSideAssets** setting `true`, your solution assets are automatically hosted in the tenant.
128
126
129
127
## Prepare web part assets to deploy
130
128
@@ -143,7 +141,7 @@ If *Office 365 CDN* is enabled, it is used automatically with default settings.
143
141
> [!NOTE]
144
142
> If you are interested in what actually got packaged inside of the sppkg file, you can look in the content of the **sharepoint/solution/debug** folder.
145
143
146
-
3. Upload or drag and drop the newly created client-side solution package to the app catalog in your tenant.
144
+
3. Upload or drag and drop the newly created client-side solution package to the app catalog in your tenant.
147
145
148
146
4. Because you already deployed the package, you are prompted as to whether to replace the existing package. Select **Replace It**.
149
147
@@ -172,7 +170,7 @@ If *Office 365 CDN* is enabled, it is used automatically with default settings.
172
170

173
171
174
172
> [!NOTE]
175
-
> If you would not have CDN enabled in your tenant, and the `includeClientSideAssets` setting would be `true`in the **package-solution.json**, the loading URL for the assets would be dynamically updated and pointing directly to the ClientSideAssets folder located in the app catalog site collection. In this example case, the URL would be `https://sppnp.microsoft.com/sites/apps/ClientSideAssets/`.
173
+
> If you would not have CDN enabled in your tenant, and the `includeClientSideAssets` setting would be `true`in the **package-solution.json**, the loading URL for the assets would be dynamically updated and pointing directly to the ClientSideAssets folder located in the app catalog site collection. In this example case, the URL would be `https://sppnp.microsoft.com/sites/apps/ClientSideAssets/`. This change is automatic depending on your tenant settings and it does not require any changes in the actual solution package.
176
174
177
175
Now you have deployed your custom web part to SharePoint Online and it's being hosted automatically from the Office 365 CDN.
178
176
@@ -181,5 +179,4 @@ Now you have deployed your custom web part to SharePoint Online and it's being h
181
179
You can load jQuery and jQuery UI and build a jQuery Accordion web part. To continue, see [Add jQueryUI Accordion to your client-side web part](./add-jqueryui-accordion-to-web-part.md).
182
180
183
181
> [!NOTE]
184
-
> If you find an issue in the documentation or in the SharePoint Framework, report that to SharePoint engineering by using the [issue list at the sp-dev-docs repository](https://github.com/SharePoint/sp-dev-docs/issues). Thanks for your input in advance.
185
-
182
+
> If you find an issue in the documentation or in the SharePoint Framework, please report that to SharePoint engineering by using the [issue list at the sp-dev-docs repository](https://github.com/SharePoint/sp-dev-docs/issues) or by adding a comment to this article. Thanks for your input in advance.
Copy file name to clipboardExpand all lines: docs/spfx/web-parts/get-started/serve-your-web-part-in-a-sharepoint-page.md
+30-28Lines changed: 30 additions & 28 deletions
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,10 @@
1
1
---
2
2
title: Deploy your client-side web part to a SharePoint page (Hello World part 3)
3
3
description: Deploy your client-side web part to SharePoint and see it working on a modern SharePoint page.
4
-
ms.date: 01/08/2018
4
+
ms.date: 08/20/2018
5
5
ms.prod: sharepoint
6
6
---
7
7
8
-
9
8
# Deploy your client-side web part to a SharePoint page (Hello World part 3)
10
9
11
10
Ensure that you have completed the procedures in the following articles before you start:
@@ -33,26 +32,25 @@ You can also follow these steps by watching this video on the SharePoint PnP You
33
32
34
33
Unlike in the Workbench, to use client-side web parts on modern SharePoint server-side pages, you need to deploy and register the web part with SharePoint. First you need to package the web part.
35
34
36
-
3. Open the **HelloWorldWebPart** web part project in Visual Studio Code, or your preferred IDE.
35
+
3. Open the **HelloWorldWebPart** web part solution in Visual Studio Code, or your preferred IDE.
37
36
38
37
4. Open **package-solution.json** from the **config** folder.
39
38
40
39
The **package-solution.json** file defines the package metadata as shown in the following code:
5. In the console window, enter the following command to package your client-side solution that contains the web part:
@@ -73,14 +71,13 @@ The package uses SharePoint Feature to package your web part. By default, the gu
73
71
74
72
You can view the raw package contents in the **sharepoint/debug** folder.
75
73
76
-
The contents are then packaged into an **.sppkg** file. The package format is very similar to a SharePoint Add-ins package and uses Microsoft Open Packaging Conventions to package your solution.
74
+
The contents are then packaged into an **.sppkg** file. The package format is very similar to a SharePoint add-ins package and uses Microsoft Open Packaging Conventions to package your solution.
77
75
78
-
The JavaScript files, CSS, and other assets are packaged inside of the package when the `--ship` option is used. In this case, however, we will first test deployment and capabilities by hosting JavaScript files from localhost. This deployment option is explained in the next tutorial.
76
+
The JavaScript files, CSS, and other assets are packaged inside of the package when the `--ship` option is used. In this tutorial, however, we will first test deployment and capabilities by hosting JavaScript files from localhost. Automated packaging and hosting option is explained in the next tutorial.
79
77
80
78
> [!NOTE]
81
79
> Starting from the SharePoint Framework v1.4, static assets are by default packaged inside of the sppkg package. When a package is deployed in the app catalog, the assets are automatically hosted either from Office 365 CDN (if enabled) or from an app catalog URL. You can control this behavior with the `includeClientSideAssets` setting in the `package-solution.json` file.
82
80
83
-
84
81
## Deploy the HelloWorld package to app catalog
85
82
86
83
Next, you need to deploy the package that was generated to the app catalog.
@@ -92,18 +89,20 @@ Next, you need to deploy the package that was generated to the app catalog.
92
89
93
90
2. Upload or drag and drop the **helloworld-webpart.sppkg** to the app catalog.
94
91
95
-

92
+

96
93
97
94
This deploys the client-side solution package. Because this is a full trust client-side solution, SharePoint displays a dialog and asks you to trust the client-side solution to deploy.
Notice that you can see if there's any exceptions or issues in the package by looking the *App Package Error Message* column in the app catalog.
101
+
103
102
104
103
## Install the client-side solution on your site
105
104
106
-
1. Go to your developer site collection.
105
+
1. Go to your developer site collection or site collection which you want to use for testing
107
106
108
107
2. Select the gears icon on the top nav bar on the right, and then select **Add an app** to go to your Apps page.
109
108
@@ -121,7 +120,7 @@ The **Site Contents** page shows you the installation status of your client-side
121
120
122
121
## Preview the web part on a SharePoint page
123
122
124
-
Now that you have deployed and installed the client-side solution, add the web part to a SharePoint page. Remember that resources such as JavaScript and CSS are available from the local computer.
123
+
Now that you have deployed and installed the client-side solution, add the web part to a SharePoint page. Remember that resources such as JavaScript and CSS are available from the local computer, so rendering of the web parts will fail unless your localhost is running.
125
124
126
125
1. Open the `<your-webpart-guid>.manifest.json` from the `\dist` folder.
127
126
@@ -133,7 +132,7 @@ Now that you have deployed and installed the client-side solution, add the web p
133
132
]
134
133
```
135
134
136
-
2. Before adding the web part to a SharePoint server-side page, run the local server.
135
+
2.**Before** adding the web part to a SharePoint server-side page, run the local server.
137
136
138
137
3. In the console window that has the **helloworld-webpart** project directory, run the gulp task to start serving from localhost:
139
138
@@ -142,20 +141,23 @@ Now that you have deployed and installed the client-side solution, add the web p
142
141
```
143
142
144
143
> [!NOTE]
145
-
> `--nobrowser` will not automatically launch the SharePoint Workbench.
144
+
> `--nobrowser` will not automatically launch the SharePoint Workbench as that's not needed in this case as we will host the web part directly in SharePoint page.
146
145
147
146
## Add the HelloWorld web part to modern page
148
147
149
148
1. In your browser, go to your site where the solution was just installed.
150
-
149
+
151
150
2. Select the gears icon in the top nav bar on the right, and then select **Add a page**.
152
-
153
-
3. Edit the page.
151
+
152
+
3. Edit the page.
154
153
155
154
4. Open the web part picker and select your **HelloWorld** web part.
156
-
155
+
156
+
> [!NOTE]
157
+
> Screenshots are from a site which is using modern experience.
158
+
157
159
The web part assets are loaded from the local environment. To load the scripts hosted on your local computer, you need to enable the browser to load unsafe scripts. Depending on the browser you are using, make sure you enable loading unsafe scripts for this session.
158
-
160
+
159
161
You should see the **HelloWorld** web part you built in the previous article that retrieves lists from the current site.
160
162
161
163

@@ -167,22 +169,22 @@ You should see the **HelloWorld** web part you built in the previous article tha
167
169

168
170
169
171
This is the same property pane you built and previewed in the Workbench.
170
-
172
+
171
173
2. Edit the **Description** property, and enter **Client-side web parts are awesome!**
172
-
174
+
173
175

174
176
175
177
3. Notice that you still have the same behaviors such as a reactive pane where the web part is updated as you type.
176
178
177
179
4. Select the **x** icon to close the client-side property pane.
178
-
180
+
179
181
5. On the toolbar, select **Save and close** to save the page.
180
182
181
183
## Next steps
182
184
183
-
Congratulations! You have deployed a client-side web part to a modern SharePoint page.
185
+
**Congratulations!** You have deployed a client-side web part to a modern SharePoint page.
184
186
185
-
You can continue building out your Hello World web part in the next topic [Hosting client-side web part from Office 365 CDN](./hosting-webpart-from-office-365-cdn.md), where you will learn how to deploy and load the web part assets from an Office 365 CDN instead of localhost.
187
+
You can continue building out your Hello World web part in the next topic [Hosting client-side web part from Office 365 CDN](./hosting-webpart-from-office-365-cdn.md), where you will learn how to deploy and load the web part assets from an Office 365 CDN instead of localhost, which means that you are preparing this solution for shipping or using it in production environment.
186
188
187
189
> [!NOTE]
188
-
> If you find an issue in the documentation or in the SharePoint Framework, report that to SharePoint engineering by using the [issue list at the sp-dev-docs repository](https://github.com/SharePoint/sp-dev-docs/issues). Thanks for your input in advance.
190
+
> If you find an issue in the documentation or in the SharePoint Framework, please report that to SharePoint engineering by using the [issue list at the sp-dev-docs repository](https://github.com/SharePoint/sp-dev-docs/issues) or by adding a comment to this article. Thanks for your input in advance.
0 commit comments