StencilJS : Is it possible to set "globalStyle" on the stencil.config.ts file to a css from a node_module

656 Views Asked by At

Trying to set a global style css file on my stencil project. The only issue is that the specific css file I want to link is inside a node_module. I know I can import the css for each component but I was hoping to set it as a globalStyle.

Whenever I try to do it for some reason it gives me the following error

"The file {./node_modules/@styles/file.css}" was unable to load.

1

There are 1 best solutions below

0
On BEST ANSWER

You can try using a copy task to bring that file from node_modules to your dist, and reference that css file in index.html

if you are using www output target, copy task config can look like this

outputTargets: [
    {
      type: 'www',
      dir: 'public',
      copy: [
        { src: '../node_modules/@styles/file.css', dest: 'assets/css' }
      ]
    }
  ]