Sp-dev-docs: Create an SPFX extension that calls a CSS file by enabling it to add design to my SharePoint Online site

Created on 24 Oct 2018  路  4Comments  路  Source: SharePoint/sp-dev-docs

  • Question :

Hello,

I would like to know if it is possible to call a CSS file that I add in my library of the document on sharepoint online and apply this CSS on my site while using a SharePoint Framework Extension.

So, i want to create a sharepoint framework extension, and when it is deployed on a sharepoint online site, it calls an existing CSS file in the document library and applies this CSS on this site.

Is it possible to do that please ?

Thank you in advance for your answers.

spfx-general question

Most helpful comment

This scenario is not supported and can cause problems with the overall experience of SharePoint Online.
In SPFx framework included are mechanisms that allow you to scope the CSS to web parts and extensions that use CSS Modules to make sure that the CSS changes only our component.

If you put the style sheet in a library you have a blank CSS and a use can add whatever he likes to add there. For example, define a global background for all pages, changes the overall font and do a lot more unsupported things.

Please see: Work with CSS in SharePoint Framework

All 4 comments

This scenario is not supported and can cause problems with the overall experience of SharePoint Online.
In SPFx framework included are mechanisms that allow you to scope the CSS to web parts and extensions that use CSS Modules to make sure that the CSS changes only our component.

If you put the style sheet in a library you have a blank CSS and a use can add whatever he likes to add there. For example, define a global background for all pages, changes the overall font and do a lot more unsupported things.

Please see: Work with CSS in SharePoint Framework

Merci beaucoup pour votre r茅ponse.

Bonjour,

C'est possible en fait, en utilisant SPComponentLoader, j'ai r茅ussi a cr茅er un fichier css que j'ai mis dans mes documents sur sharepoint online, j'ai r茅alis茅 une extension qui charge la css 脿 partir d'une url, tout en respectant les m锚mes classes existantes d茅j脿 sur le site.

Veuillez voir : https://docs.microsoft.com/fr-fr/sharepoint/dev/spfx/web-parts/guidance/reference-third-party-css-styles

Issues that have been closed & had no follow-up activity for at least 7 days are automatically locked. Please refer to our wiki for more details, including how to remediate this action if you feel this was done prematurely or in error: Issue List: Our approach to locked issues

Was this page helpful?
0 / 5 - 0 ratings