A table generating a API using falso
- Add this plugin to your WordPress installation, turn it on, and add it to a WordPress Page.
It should look like this:
-
Within the project, run
nvm i
&npm i
in the command line to switch to a working node version and install dependencies. -
Generate the fake payload
npm run generate
- that will run node fake-data/run-script.js 100
(100 means it generates 100 entries. Modify this command to change the number.)
It'll create a fake-data/fake-payload.json
if it doesn't exist, or refresh it.
- As a test, the file will then be dynamically imported into your WP block.
Inside src/script.js
, you'll see a function called getFakeData()
, which simulates a restAPI call to pull data from your fake payload.
-
Edit your styles in
src/style.css
-
In the command line:
npm run style
That will build src/style.css
to fake-content-block/style.css
. It will look for any tailwind classes and compile them.
Query Monitor - This will allow you to debug errors in your devtools. To show log data, use do_action( 'qm/debug', $variable_here );
. Documentation
Had to remove this because i need it loaded in the footer.
{
"viewScript": "file:../fake-content-block/script.js",
}