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

Injecting link tags and script tags with import doesn't work #110

Open
baermathias opened this issue Feb 6, 2023 · 0 comments
Open

Injecting link tags and script tags with import doesn't work #110

baermathias opened this issue Feb 6, 2023 · 0 comments

Comments

@baermathias
Copy link

If the following is your config:

inject: {
  data: {
    injectParagraphTag: `<p>this is a paragraph</p>`,
    injectScriptTag: `<script type="module">
        const origin = window.location.origin;
        import(origin + '/modules/components@1.0.0/dist/index.umd.js')
      </script>`,
    injectLinkTag: `<link rel="stylesheet" href="/../modules/components/css/fonts.css" />`,
    injectCustomElement: `<custom-link-tag rel="stylesheet" href="/../modules/components/css/fonts.css" />`,
  },
}

And these are the ejs tags in your index.html:

  <%- injectParagraphTag %>
  <%- injectScriptTag %>
  <%- injectLinkTag %>
  <%- injectCustomElement %>

Then this will be the result:

  <p>this is a paragraph</p>
  
  
  <custom-link-tag rel="stylesheet" href="/../modules/components/css/fonts.css" />
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

1 participant