feat(v2): add scripts and stylesheets field to config#1831
Conversation
|
Deploy preview for docusaurus-2 ready! Built with commit bff9eb6 |
|
Deploy preview for docusaurus-preview ready! Built with commit bff9eb6 |
yangshun
left a comment
There was a problem hiding this comment.
Nice! This will make it much easier to migrate.
| <link rel="stylesheet" key={source} href={source} /> | ||
| ), | ||
| )} | ||
| {scripts && |
There was a problem hiding this comment.
Do we inject scripts here in V1? Putting scripts here blocks page rendering which is bad, unless they use async. Maybe we should allow injecting before </body>, but that'll be more complicated.
There was a problem hiding this comment.
yep its done like this in v1
|
I followed the SO link here: https://stackoverflow.com/a/58349826/582917. Is it possible to add in custom HTML tags like |
|
@CMCDragonkai Please don't necropost—perfect way to get your question undiscoverable. We don't have a first-class API for any tag, but you can get away with a plugin API: // docusaurus.config.js
module.exports = {
// ...
plugins: [
() => ({
name: "inject-tag",
injectHtmlTags() {
return {
headTags: [{ tagName: "base", attributes: { href: "https://www.example.com/" } }],
};
},
}),
],
}; |
Motivation
Add
scriptsandstylesheetsfield to docusaurus.config. for v1 parity and enable user to use external resources script or stylesheetsHave you read the Contributing Guidelines on pull requests?
yes
Test Plan
Add random scripts and stylesheets into config