Languages
[Edit]
EN

Gatsby - static resources (js, css, gfx)

6 points
Created by:
Aston-Freeman
787

In this short article we would like to show the simplest way how to use static resources in Gatsby. This way it is possible to attach any additional js file, css style file or image to project.

Simple steps:

  1. create static/ directory directly in your Gatsby project,
  2. paste inside static/ directory some files or directores, e.g.
    my-style.css
    my-script.js
    my-image.png
    some-dir/my-image.css
    some-dir/my-script.js
    some-dir/my-image.png
  3. access resources directly with:
    http://localhost:8000/my-style.css
    http://localhost:8000/my-script.js
    http://localhost:8000/my-image.png
    http://localhost:8000/some-dir/my-image.css
    http://localhost:8000/some-dir/my-script.js
    http://localhost:8000/some-dir/my-image.png

Note: official documentation is located here.

Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

Gatsby

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

â€ïžđŸ’» 🙂

Join