这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@await-ovo
Copy link
Contributor

Support setting options.injectStyle as a function that returns JS code to add CSS in a custom way, like rollup-plugin-postcss.

This can be used in some cases such as when adding styles to shadowRoot:

export defineConfig({
   injectStyle: (css) => {
    return `
        var setStyle = function() {
          setTimeout(() => {
            try {
              var style = document.createElement('style');
              style.type = 'text/css';
              style.innerHTML = ${css};
              var root = document.getElementsByTagName('${tag}')[0].shadowRoot;
              root.insertBefore(style);
            } catch {
              setStyle()
            }
          },1000)
        };
        setStyle();
      `;
  },
})

@codesandbox
Copy link

codesandbox bot commented Mar 10, 2023

CodeSandbox logoCodeSandbox logo  Open in CodeSandbox Web Editor | VS Code | VS Code Insiders

@vercel
Copy link

vercel bot commented Mar 10, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
tsup ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Mar 10, 2023 at 10:05AM (UTC)

@github-actions
Copy link
Contributor

🎉 This PR is included in version 6.7.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants