Using asp-prerender-module with Office 365 Fabric and React #986

Closed
opened 2025-08-09 17:18:26 +00:00 by fergalmoran · 0 comments
Owner

Originally created by @wiredprairie on 2/24/2017

I'm trying to use server-side prerendering with Office 365 Fabric components.

I'm not sure what the best way to handle their method of injecting styles would be.

import { configureLoadStyles } from '@microsoft/load-themed-styles';

// Store registered styles in a variable used later for injection.
let _allStyles = '';

// Push styles into variables for injecting later.
configureLoadStyles((styles: string) => {
  _allStyles += styles;
});

The _allStyles must be injected into a style tag:

<style>${ _allStyles}</style>

Should I create another asp-prerender-module to be included in _Layout.cshtml, or is there a more elegant (and possibly more efficient) method for doing this style/string injection?

*Originally created by @wiredprairie on 2/24/2017* I'm trying to use server-side prerendering with [Office 365 Fabric components](https://github.com/OfficeDev/office-ui-fabric-react). I'm not sure what the best way to handle their method of injecting styles would be. import { configureLoadStyles } from '@microsoft/load-themed-styles'; // Store registered styles in a variable used later for injection. let _allStyles = ''; // Push styles into variables for injecting later. configureLoadStyles((styles: string) => { _allStyles += styles; }); The `_allStyles` must be injected into a `style` tag: <style>${ _allStyles}</style> Should I create another `asp-prerender-module` to be included in `_Layout.cshtml`, or is there a more elegant (and possibly more efficient) method for doing this style/string injection?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#986
No description provided.