Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source static resources from multiple directories #3983

Closed
oriooctopus opened this issue Jan 1, 2021 · 3 comments
Closed

Source static resources from multiple directories #3983

oriooctopus opened this issue Jan 1, 2021 · 3 comments
Labels
feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future.

Comments

@oriooctopus
Copy link
Contributor

oriooctopus commented Jan 1, 2021

🚀 Feature

Right now the static directory from which resources are sourced is hardcoded as /static ... I would like to be able to source from both /static and another folder.

Have you read the Contributing Guidelines on issues?

Yes

Motivation

This will be useful to me because I have an npm module that has shared components between two of my docusaurus sites. I would like to put shared images and fonts there so that I don't have to update them individually on both of the sites and can just do it in one place

Pitch

This increases the maintainability of docusaurus sites that have shared code such as mine. Right now it is pretty tedious to have to update shared images in two places instead of one, especially given the rapid rate at which docs sites change.

I believe the changes necessary are in the configureWebpack call of plugin-content-docs/blog/pages, but I'm not 100% sure

@oriooctopus oriooctopus added feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future. status: needs triage This issue has not been triaged by maintainers labels Jan 1, 2021
@oriooctopus
Copy link
Contributor Author

@slorber if this is not an existing feature, I would be willing to implement it myself!

@slorber
Copy link
Collaborator

slorber commented Jan 11, 2021

Thanks @oriooctopus , that would be great.

We even have the usecase for this in the Docusaurus site itself, as the blog markdown files are shared between the v1 and v2 websites, and we have to actually duplicate blog post assets in both sites:

In such case, it would have been simpler to just tell Docusarus 2 to use website-1.x/static/img as a secondary assets folder.

Let me know if you need help implementing this, as it might involve changes in multiple locations, including the mdx loader (remark/transformImage/index.js).

To dogfoog, you can directly use this feature on the Docusaurus 2 website mentioned above :)

That would be interesting to have an algo to detect when the image exist in multiple static folders, to avoid unwanted overrides

@Josh-Cena Josh-Cena removed the status: needs triage This issue has not been triaged by maintainers label Oct 30, 2021
@Josh-Cena
Copy link
Collaborator

Implemented in #4095

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future.
Projects
None yet
Development

No branches or pull requests

3 participants