Skip to main content
edited tags
Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284
another tryout
Source Link
DarkteK
  • 427
  • 3
  • 17

I'm trying to run this library ParticleJS which requires me to download a Json.

I added this file into theme/libraries.yml butthis way:

global-js:
  js:
    assets/js/particles.min.js : {}
    assets/js/particles.json : {}

But that gives me this error:

Refused to execute script from 'https://www.example.com/themes/nexus/assets/js/particles.json?pem8cm' because its MIME type ('application/json') is not executable, and strict MIME type checking is enabled.

So I'm trying to add the file via twig usingadded:

<script src="themes/nexus/assets/js/particles.json"></script>

And it is giving me the @include but it's not working eithersame error.

Can someone help me with this problem, please? How should I include any other file into twig templates? Thank you

I'm trying to run this library ParticleJS which requires me to download a Json.

I added this file into theme/libraries.yml but that gives me this error:

Refused to execute script from 'https://www.example.com/themes/nexus/assets/js/particles.json?pem8cm' because its MIME type ('application/json') is not executable, and strict MIME type checking is enabled.

So I'm trying to add the file via twig using the @include but it's not working either.

Can someone help me with this problem, please? How should I include any other file into twig templates? Thank you

I'm trying to run this library ParticleJS which requires me to download a Json.

I added this file into theme/libraries.yml this way:

global-js:
  js:
    assets/js/particles.min.js : {}
    assets/js/particles.json : {}

But that gives me this error:

Refused to execute script from 'https://www.example.com/themes/nexus/assets/js/particles.json?pem8cm' because its MIME type ('application/json') is not executable, and strict MIME type checking is enabled.

So I'm added:

<script src="themes/nexus/assets/js/particles.json"></script>

And it is giving me the same error.

Can someone help me with this problem, please? How should I include any other file into twig templates? Thank you

Source Link
DarkteK
  • 427
  • 3
  • 17

Include Json file into Twig template

I'm trying to run this library ParticleJS which requires me to download a Json.

I added this file into theme/libraries.yml but that gives me this error:

Refused to execute script from 'https://www.example.com/themes/nexus/assets/js/particles.json?pem8cm' because its MIME type ('application/json') is not executable, and strict MIME type checking is enabled.

So I'm trying to add the file via twig using the @include but it's not working either.

Can someone help me with this problem, please? How should I include any other file into twig templates? Thank you