swiper icon indicating copy to clipboard operation
swiper copied to clipboard

core modules + modules injectStylesUrls

Open TerryXu-98 opened this issue 7 months ago • 1 comments

@nolimits4web first of all, thanks for creating the wonderful library.

In a project, we're trying to migrate from Swiper React to Elements, and I second @awacode21 comments, the documentation does not provide enough clarity on what to do. My code is almost exactly as documented here but this part of the documentation is a bit vague:

we also need to add modules styles globally and also inject modules styles to the shadow DOM

  • Does "add modules styles globally" mean import "swiper/element/css/pagination" in the context of a React app?

  • Does "inject modules styles to the shadow DOM" mean injectStylesUrls: ["swiper/element/css/pagination"]?

  • If not, how can we inject the existing styles provided by the package (i.e. stylesheets that already exist like node_modules/swiper/modules/pagination-element.min.css)?

Thanks for the response.

Originally posted by @arman-h in #7485

TerryXu-98 avatar Apr 03 '25 03:04 TerryXu-98

#7485 #issuecomment-2933800992

If you're using Vite, please read comment above.

If not, you may have to read your bundler's document for assets handling reference.

bamf2077 avatar Jun 03 '25 07:06 bamf2077