1.0.4 • Published 5 years ago

strapi-to-static v1.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

Strapi to static

You can use this little global node utility to fetch your strapi endpoints and save them as static JSON files in a dir of your choice.

The idea behind it has born while needing to embed server contents in a static-generated website. You can then make them dynamic-like triggering strapi-to-static and a re-build.

It's extremely simple and easy to use.

Install globally:

npm install -g strapi-to-static

Accepted CLI arguments:

nametypedescription
contentTypesarraycontent types slugs to fetch from your strapi server
dirstringdefine your JSON files output directory
apiURLstringthe URL in which your strapi server runs

Example of usage:

strapi-to-static --contentTypes=['news'] --dir=src/data --apiURL=http://localhost:1337

Then you will have your endpoints exported as single JSON files in the chosen directory.

The best thing is to associate it with a custom "scripts" command in a project's package.json, so the output dir is relative to it.

Example:

{
  "scripts": {
    "fetch": "strapi-to-static --contentTypes=['news'] --dir=src/data --apiURL=http://localhost:1337",
  },
}
1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago