E
E
epicfail1692016-10-29 16:34:26
JSON
epicfail169, 2016-10-29 16:34:26

How to use gulp to generate a separate html page for each element from a JSON array?

Apologies for the abstract
products.json example

[{
  "products": [
    {
      "Title":"Product 1",
      "Description":"Text 1",
      "Price":"500"
    },
    {
      "Title":"Product 2",
      "Description":"Text 2",
      "Price":"2000"
    },
    {
      "Title":"Product 3",
      "Description":"Text 3",
      "Price":"1000"
    }
  ]
}]

product.jade
doctype html

html
    head
        meta(charset="utf-8")
    body
            h1= Title
            p= Description
            h4= Price

At the output, I would like to get an html page for each of the products .
The closest solution to my problem . Its disadvantage is that a separate JSON file is created for each product, such as product-A.json, product-B.json, product-C.json
I lack the skill to convert this solution into one JSON file. I hope this is possible at all and I was not wasting my time

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question