What are the options for storing and retrieving data for a static website (HTML, CSS, JavaScript)? As an example, I need to store some data for a portfolio website and set it on build process. In this case, no frequent updates required but it would be nice to store name, list of personal projects, contacts, and other info separately. Gatsby framework provides such an option by storing data in .md, .js file and retrieves it on the build process. I’d like to do the same but without using any framework only bundler like webpack or parcler.js. Any npm modules that can do the job?
If you want to statically load the data on build, your best bet is to use something like Webpack or Parcel, then it’s as simple as const mydata = require('./mydata.json').
Gatsby’s design is unique and way more sophisticated when it comes to loading resources, but fancy data extraction from various places is Gatsby’s whole reason for being.
This way all the data will be accessed on page load. What I want is to set this data on the build stage. In other words, I want it to be hard-coded by a building tool.
Thank you for your response anyway.
This has nothing to do with when the page is loaded. The build tool will import the object and it will be available to reference anywhere in the built code.