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

[help] issues with html-loader interpolation #57

Open
zacharyrs opened this issue Jan 13, 2019 · 3 comments
Open

[help] issues with html-loader interpolation #57

zacharyrs opened this issue Jan 13, 2019 · 3 comments

Comments

@zacharyrs
Copy link

Hi,

I'm in the works of developing my own static site generator that relies on pug templates, and markdown content.

I use webpack to bundle the precompiled pug (i.e. html) files, along with css+js, and also to process images etc.

I'm facing an issue using html-interpolation, such that the output bundle has undefined for image sources etc.

For reference, the compiled HTML looks as such:

...
    <script src="${require('../../base/templates/index.sss')}"></script>
...
            <span class="image-wrapper">
                <img class="image-preview" src=${require('../../content/pages/res/mini.jpg').preview} alt="test" title="sss">
                <img class="image-main" onload="this.classList.add('image-loaded')" src=${require('../../content/pages/res/mini.jpg').src} srcset=${require('../../content/pages/res/mini.jpg').srcSet} alt="test" title="sss">
            </span>
...

Webpack does include and process the required images, however the output HTML is as such:

...
    <script src="[object Object]"></script>
...
            <span class="image-wrapper">
                <img class="image-preview" src=undefined alt="test" title="sss">
                <img class="image-main" onload="this.classList.add('image-loaded')" src=undefined srcset=undefined alt="test" title="sss">
            </span>
...

The css interpolated require also appears to have issues, but this may be at my own fault.

The repo may be found here: https://github.com/zacharyrs/ssg.z

Hopefully someone can see where I'm going wrong, or if this is at fault of extract-loader.

Thanks,
Zach

@zacharyrs
Copy link
Author

Probably related to #54.

vseventer added a commit to vseventer/extract-loader that referenced this issue Apr 27, 2020
vseventer added a commit to vseventer/extract-loader that referenced this issue May 10, 2020
jannikkeye pushed a commit that referenced this issue May 26, 2020
* Use unique placeholders for each match - fixes #54 #57 #80

* Refactor pattern flow.
@jannikkeye
Copy link
Contributor

@zacharyrs can you verify that the latest changes fixed this issue?

@zacharyrs
Copy link
Author

I'm a little busy with uni at the moment, but I'll check it ASAP in the next couple of weeks!

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

2 participants