-
Notifications
You must be signed in to change notification settings - Fork 0
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
Images import #4
Comments
Hi @Djaler, thanks for reporting it, can you provide a concrete example or point me to the repo where you are using it? I am using an image here: https://raw.githubusercontent.com/carlosvin/carlosvin.github.io/site/static/posts/cpp-pragma-pack.en.adoc |
That's because you're using absolute path to image, not relative. I'll provide an example soon |
I understand. How would you suggest this plugin should behave when there is a relative image link? |
Currently, in webpack I have this config:
Where
As you can see, I don't know how to do this in rollup, or rather in vitejs (vite uses rollup plugins) |
This plugin is not generating html, it is generating a javascript string that contains the converted html. I've modified the previous example to use relative paths and it still works: https://carlosvin.github.io/posts/cpp-pragma-pack/en/ Can you point me to an example to help me understand what you are trying to achieve? |
https://github.com/Djaler/vite-adoc-image-import-error check this, please |
I see the problem, but I don't know how to solve it yet. Here it is a sample of what {
meta: {
title: "Post title",
date: "2019-11-11"
},
html: "<p>Such a post!</p>"
} This is just Javascript code and it doesn't know anything about the content of the generated html stored in I could modify the plugin to generate html, but then I will lost the Any idea how to solve this issue is very welcome! |
Just as an idea about meta - it could be imported separetely, like |
I didn't know about the question mark in the import, can you elaborate your idea a little bit more? |
This is just a way to point your import to the same file, but provide an additional params to webpack loader, rollup plugin, etc.(for example https://vitejs.dev/guide/features.html#static-assets) |
Also, more about how it works now in webpack with html-loader: https://webpack.js.org/loaders/html-loader/#sources
This is why result html contains correct path to bundled image |
I am trying to figure out how to parse handle assets from plugins, so once we have the HTML generated, we parse it again to extract the assets, but I've found an open issue in Rollup to allow to handle assets from plugins: rollup/rollup#2872 For now I can provide a couple of workarounds: Workaround 2: |
I am working now on a plugin/function to process html like in html-loader |
Feel free to create a PR o let me know how I can help. |
If anyone interested in such feature, it is implemented in my plugin https://github.com/Djaler/vite-plugin-asciidoc |
If I have image in adoc file, it results to tag with original src. And of course there are no image at this source after bundle.
The text was updated successfully, but these errors were encountered: