Skip to content

Commit 12f9370

Browse files
authored
Update use-fabric-react-components.md
1 parent b4c29ad commit 12f9370

File tree

1 file changed

+7
-57
lines changed

1 file changed

+7
-57
lines changed

docs/spfx/web-parts/get-started/use-fabric-react-components.md

Lines changed: 7 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,18 @@ You can also follow these steps by watching this video on the SharePoint PnP You
5959

6060
At this point, Yeoman installs the required dependencies and scaffolds the solution files. This might take a few minutes. Yeoman scaffolds the project to include your DocumentCardExample web part as well.
6161

62-
6. When initial scaffolding is completed, enter the following to explicitly install the 5.x version of the Office UI Fabric to your solution:
62+
6. When initial scaffolding is completed, you may need to explicitly add a version of office-ui-fabric-react to your package.json file. If you are using version 1.8.2 or later of the generator, you won't need to worry about this, but older versions will. Open your package.json file, and look for an entry for 'office-ui-fabric-react'. If there isn't one, add the following entry in your dependencies section
6363

6464
```
65-
npm install [email protected] --save
65+
"office-ui-fabric-react": "5.132.0"
66+
```
67+
followed by the following command at your command prompt.
68+
```
69+
npm install
6670
```
6771

6872
> [!NOTE]
69-
> Starting with SharePoint Framework 1.8, you can use either Office UI Fabric version 5 or version 6. In this case we are using specifically Office UI Fabric version 5.132.0, so we are adding the needed dependency on it. If you would be using Office UI Fabric version 6.x, you'd also need to update the used TypeScript version of the solution.
73+
> Starting with SharePoint Framework 1.8, you can use either Office UI Fabric version 5 or version 6. In this case we are using specifically Office UI Fabric version 5.132.0, so we are adding the needed dependency on it. If you would be using Office UI Fabric version 6.x, you'd also need to update the used TypeScript version of the solution. To use fabric 6, you need to be on at least rush-stack-compiler-2.9 . The default project created with version 1.8.2 for SharePoint Online will use rush-stack-compiler-2.9 and fabric 6 (and won't need the step to add office-ui-fabric-react to your package.json file). Previous versions use either rush-stack-compiler 2.7 or a build system that is locked to typescript 2.4. In those cases, you'll need to reference fabric 5.132.0. If you are targeting on-prem, you will also want to use fabric 5.132.0.
7074
7175

7276
7. Next, enter the following to open the web part project in Visual Studio Code:
@@ -187,60 +191,6 @@ Because we chose React as our framework when creating the solution, the generato
187191

188192
The `previewProps` property includes some properties of the DocumentCardPreview.
189193

190-
5. Notice the use of the relative path with a `require` statement to load images. Currently, you need to perform a small configuration in the gulpfile.js to enable these images to get processed properly by webpack.
191-
192-
6. Open **gulpfile.js** from the **root** folder.
193-
194-
7. Add the following code just above the `build.initialize(gulp);` code line.
195-
196-
```js
197-
build.configureWebpack.mergeConfig({
198-
additionalConfiguration: (generatedConfiguration) => {
199-
if (build.getConfig().production) {
200-
var basePath = build.writeManifests.taskConfig.cdnBasePath;
201-
if (!basePath.endsWith('/')) {
202-
basePath += '/';
203-
}
204-
generatedConfiguration.output.publicPath = basePath;
205-
}
206-
else {
207-
generatedConfiguration.output.publicPath = "/dist/";
208-
}
209-
return generatedConfiguration;
210-
}
211-
});
212-
```
213-
214-
8. Save the file.
215-
216-
Your full **gulpfile.js** file should look as follows.
217-
218-
```js
219-
'use strict';
220-
221-
const gulp = require('gulp');
222-
const build = require('@microsoft/sp-build-web');
223-
build.addSuppression(`Warning - [sass] The local CSS class 'ms-Grid' is not camelCase and will not be type-safe.`);
224-
225-
build.configureWebpack.mergeConfig({
226-
additionalConfiguration: (generatedConfiguration) => {
227-
if (build.getConfig().production) {
228-
var basePath = build.writeManifests.taskConfig.cdnBasePath;
229-
if (!basePath.endsWith('/')) {
230-
basePath += '/';
231-
}
232-
generatedConfiguration.output.publicPath = basePath;
233-
}
234-
else {
235-
generatedConfiguration.output.publicPath = "/dist/";
236-
}
237-
return generatedConfiguration;
238-
}
239-
});
240-
241-
build.initialize(gulp);
242-
243-
```
244194

245195
## Copy the image assets
246196

0 commit comments

Comments
 (0)