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

allow local configuration for cdn assets #4

Closed
DryHumorInDC opened this issue Feb 2, 2024 · 12 comments · Fixed by #8
Closed

allow local configuration for cdn assets #4

DryHumorInDC opened this issue Feb 2, 2024 · 12 comments · Fixed by #8

Comments

@DryHumorInDC
Copy link

DryHumorInDC commented Feb 2, 2024

One of my environments is offline/air-gapped, and this environment does not jive well with this extension. Can you find a way to specify a local location in lieu of fetching over the network? It looks like that resource is hard-coded in ./lib/converter/treeline-to-html-converter.sh

I can install the material-icon-theme npm module by bringing that resource over manually, but I need a way to point at that local resource.

@lask79
Copy link
Owner

lask79 commented Feb 3, 2024

Can you tell me more about your use case?
Are you using plain asciidoctorjs or antora?

Would it be enough to provide a way to override the path so that you can define where to look for the icons?

Something like this:

const default path =  `https://cdn.jsdelivr.net/npm/material-icon-theme@4.32.0/icons`
const url = (getPathFromConfiguration() || default_path) + `/${icon}`

Is that enough? I also was thinking about retrieving all used icons into a local folder and then to point to the local folder in a relative way.

@DryHumorInDC
Copy link
Author

I'm using Antora.

Yes -- if I could configure a path, that would be great. Ideally, it would be something that could be set in any runtime, but my priority is Antora.

@DryHumorInDC
Copy link
Author

I wonder if it's possible to also add these icons to the Antora UI Bundle? I'd be willing to throw these in there, but I'd still need a way to specify an alternate path.

@lask79
Copy link
Owner

lask79 commented Feb 5, 2024

About Antora I was thinking about directly adding the icons into the UI catalog so that the build process is putting then into the right folders.
Putting them into UI bundle might not be effective because then you need to know upfront which icons you want to use and adding all icons would make the ui-bundle quite big. Doing this during the Antora build has the benefit that only the files will be copied that are used in the pages.

I will take a look into this how easy this could be implemented or if there could be also an intermediate solution. A dynamic and a configurable static approach.

@DryHumorInDC
Copy link
Author

That would be terrific, thank you!

lask79 added a commit that referenced this issue Feb 5, 2024
@lask79 lask79 closed this as completed in #8 Feb 5, 2024
lask79 added a commit that referenced this issue Feb 5, 2024
Bigger refactoring:

Now generates a treeview.css instead of creating image tags
Uses roles on an tag to define the icons.
Supports antora, embedded, jsdelivr and custom url

Closes #4
lask79 added a commit that referenced this issue Feb 5, 2024
Bigger refactoring:

Now generates a treeview.css instead of creating image tags
Uses roles on an tag to define the icons.
Supports antora, embedded, jsdelivr and custom url

Closes #4
@lask79
Copy link
Owner

lask79 commented Feb 5, 2024

So I implemented multiple improvements:

  • Antora copies now all used icons to img/treeview as default from the material-icons-theme module

  • Asciidoctor uses jsdelivr as default url

  • Additionally it is possible to

    • embed icons in css as data-uri (antora: icon_source: embedded | Asciidoctor: :treeview-icon-source: embedded)
    • custom url in Asciidoctor :treeview-icon-source:

    Please read the documentation for further information and try it out. Feedback is appreciated.

@lask79
Copy link
Owner

lask79 commented Feb 7, 2024

@DryHumorInDC is this working for you?

@DryHumorInDC
Copy link
Author

So sorry, I just saw this. Unfortunately, I am not only without Internet connectivity at runtime, but also at build-time. Therefore, I shall try moving the assets and utilizing the :treeview-icon-source property. I should have time to do this by Friday, and I'll let you know. The approach seems quite doable, so thank you in advance!

@lask79
Copy link
Owner

lask79 commented Feb 7, 2024 via email

@DryHumorInDC
Copy link
Author

Ah, gotcha. I just need to wait a few more days on this. My administrators promise to have your npm module pulled in by Friday. Will tag up then. Thanks for your patience. And my have you been busy! I just looked at what you had to do to make this happen; I'm grateful. :-)

@DryHumorInDC
Copy link
Author

Success!

Thank you so much. I'm very grateful to you. I'm using the antora method, but also tested embedded with equal success.

@lask79
Copy link
Owner

lask79 commented Feb 8, 2024

That is great. Thx for using it and asking for new features to make it even better.

Have fun with the extension.

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

Successfully merging a pull request may close this issue.

2 participants