-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enabel passing attributes to script and link
- Loading branch information
Showing
2 changed files
with
32 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -134,13 +134,23 @@ class Head extends React.Component { | |
|
||
{/* External resources */} | ||
{this.props.config.stylesheets && | ||
this.props.config.stylesheets.map(source => ( | ||
<link rel="stylesheet" key={source} href={source} /> | ||
))} | ||
this.props.config.stylesheets.map( | ||
source => | ||
source.href ? ( | ||
<link key={source.href} {...source} /> | ||
) : ( | ||
<link rel="stylesheet" key={source} href={source} /> | ||
) | ||
)} | ||
{this.props.config.scripts && | ||
this.props.config.scripts.map(source => ( | ||
<script type="text/javascript" key={source} src={source} /> | ||
))} | ||
this.props.config.scripts.map( | ||
source => | ||
source.src ? ( | ||
<script key={source.src} {...source} /> | ||
) : ( | ||
<script type="text/javascript" src={source} key={source} /> | ||
) | ||
)} | ||
|
||
{this.props.config.scrollToTop && ( | ||
<script src="https://unpkg.com/[email protected]/dist/vanilla-back-to-top.min.js" /> | ||
|