Skip to content

Disable base64 representation #633

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

Closed
mittalyashu opened this issue Jul 5, 2018 · 5 comments
Closed

Disable base64 representation #633

mittalyashu opened this issue Jul 5, 2018 · 5 comments

Comments

@mittalyashu
Copy link

mittalyashu commented Jul 5, 2018

Feature request

What problem does this feature solve?

We can use a direct image URL instead of base64 representation.

carbon

How should this be implemented in your opinion?

By writing custom webpack configuration

Are you willing to work on this yourself?**

I will try.

Links

@ulivz
Copy link
Member

ulivz commented Jul 6, 2018

I am sure that we can use image URL directly. or maybe I misunderstand what you want, so could you provide a reproduction link or usage? that will be more direct.

@mittalyashu
Copy link
Author

I have used the image URL directly, but it converted into base64 representation.

Here's the repo link.

@ulivz
Copy link
Member

ulivz commented Jul 6, 2018

@mittalyashu

If you don't want it to be converted, you should move the assets to .vuepress/public

Then, change:

<img src="./assets/img/stylechip-icon.png" alt="Stylechip logo icon">

to:

<img src="/assets/img/stylechip-icon.png" alt="Stylechip logo icon">

See:

@mittalyashu
Copy link
Author

Okay, but apart from that if you can custom webpack configuration that would also be great.

@ulivz
Copy link
Member

ulivz commented Jul 6, 2018

Okay, you need to remove the default rule first:

chainWebpack: config => {
  config.module.rules.delete('images')
  config.module
    .rule('images')
      .test(/\.(png|jpe?g|gif)(\?.*)?$/)
      .use('url-loader')
        .loader('url-loader')
        .options({
          // You options here, default options:
          // limit: 10000,
          // name: `assets/img/[name].[hash:8].[ext]`
        })
}

See:

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