Skip to content

Commit ab2e4a0

Browse files
StfBauerVesaJuvonen
authored andcommitted
Add notice to always use ${style.*} reference in code (SharePoint#1685)
If CSS class in an extension will be directly used without getting added to the code the style sheet doesn't load because of the optimisation happening during the build process. People might wonder why Style Sheet won't get loaded cause they used CSS directly in their code.
1 parent d9851d3 commit ab2e4a0

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

docs/spfx/extensions/get-started/using-page-placeholder-with-extensions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ Notice that you're requesting a well-known placeholder by using the correspondin
210210
* Extension code should not assume that the expected placeholder is available.
211211
* The code expects custom properties called `Top` and `Bottom`. If the properties exist, they render inside the placeholders.
212212
* Notice that the code path for both the top and bottom placeholders is almost identical. The only differences are the variables used and the style definitions.
213+
* It is possible to use the class names defined in the style sheet directly but it is not recommended. In case no style sheet reference defined in the ```styles``` variable is found in the code, the style sheet won't get added to the page. This is because unused references will get removed during bild process.
213214
214215
9. Add the following method after the `_renderPlaceHolders` method. In this case, you simply output a console message when the extension is removed from the page.
215216

0 commit comments

Comments
 (0)