It seems there may be some confusion regarding the issue at hand. You have the option to either import a file (CSS or any other format) globally or within a specific file.
In your scenario, once you have installed the dependency (npm install keen-slider --save
), you can import the minified CSS into the necessary component. Here is an example:
import React from 'react'
import 'keen-slider/keen-slider.min.css'
import { useKeenSlider } from 'keen-slider/react'
export function IndexPage(){
const [sliderRef, slider] = useKeenSlider()
return <section className="slider-wrapper">
<div ref={sliderRef}>
<div class="keen-slider__slide">1</div>
<div class="keen-slider__slide">2</div>
<div class="keen-slider__slide">3</div>
</div>
</section>
}
By following this method, you will only import the keen-slider.min.css
in the IndexPage
.