-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Layout][Next.js] Load the content styles for the RichText component …
…(without using file proxy) (#1678) * load content styles for rich text component * fix linting errors * update changelog * fix linting error * fix lint-samples step failing
- Loading branch information
1 parent
48b2a9d
commit f32eb12
Showing
8 changed files
with
467 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
...te-sitecore-jss/src/templates/nextjs/src/lib/page-props-factory/plugins/content-styles.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { SitecorePageProps } from 'lib/page-props'; | ||
import { getContentStylesheetLink } from '@sitecore-jss/sitecore-jss-nextjs'; | ||
import { Plugin } from '..'; | ||
|
||
class ContentStylesPlugin implements Plugin { | ||
order = 2; | ||
|
||
async exec(props: SitecorePageProps) { | ||
// Get content stylessheet link, empty if styles are not used on the page | ||
const contentStyles = getContentStylesheetLink(props.layoutData); | ||
|
||
contentStyles && props.headLinks.push(contentStyles); | ||
|
||
return props; | ||
} | ||
} | ||
|
||
export const contentStylesPlugin = new ContentStylesPlugin(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.