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

[preprocessors] include support for style/script #1689

Closed
yinonov opened this issue Nov 15, 2021 · 6 comments
Closed

[preprocessors] include support for style/script #1689

yinonov opened this issue Nov 15, 2021 · 6 comments

Comments

@yinonov
Copy link

yinonov commented Nov 15, 2021

Include style/script - feature support

MD interpolation support including other MD files or partials of it {{#include /path/to/file.md}}.
will it be possible to also support script and styles
which might not be present in deployment

note that supporting local assets can get a little complex when the assets are not present in deployment. for example there could be built assets or that assets depend on 3rd (node_modules). so if the feature request is applicable, could we consider compiling these assets to the book build?

@ehuss
Copy link
Contributor

ehuss commented Nov 15, 2021

This sounds like a duplicate of #1687 (which was opened a few hours ago) and #1222 if I am understanding you correctly. You want to have a preprocessor to add additional synthesized .js files to the asset output? It currently isn't possible for preprocessors to add new files, which is what #1222 is about.

@yinonov
Copy link
Author

yinonov commented Nov 16, 2021

Seem like similar symptoms. It's kind of bundler-like loader.
Is "currently isn't possible" mean there's no way to do that? Or needs triage?

@auser
Copy link

auser commented Nov 16, 2021

@yinonov and @ehuss I've been poking around the source and I'm trying not to make any big changes to the preprocessors, but I'd like to make the PreprocessorContext mutable, which would in turn make it editable.

@ehuss does this seem like a way to go?

@auser
Copy link

auser commented Nov 17, 2021

So turning everything mutable has it's own issues. What do you think about having a preprocessor step that occurs before the preprocessing run() that returns the config object instead of a new book?

@ehuss

@ehuss
Copy link
Contributor

ehuss commented Nov 20, 2021

I don't think making the config mutable is really the right approach.

A problem with adding CSS and JS is that those are HTML-specific, but the preprocessors are renderer agnostic.

I could imagine extending the return value of the preprocessor to include additional instructions, like "include these javascript files". And somehow renderers could receive those instructions and adjust its behavior accordingly.

For things like #1222, I would imagine that extra files could also be included.

I don't know exactly what that structure would look like, or what the evolution would look like, though. For example, files could be passed in JSON, but I don't know if there is a performance concern there, and maybe providing a directory for preprocessors to pass in files would be better? Also, should things like javascript be specific for the HTML renderer, or should that just be for the HTML renderer only?

@ehuss
Copy link
Contributor

ehuss commented Jun 1, 2022

I'm going to close as a duplicate of the linked issues above.

@ehuss ehuss closed this as not planned Won't fix, can't repro, duplicate, stale Jun 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants