question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

fetch & customised name tag for loop tag is not working

See original GitHub issue
  • Framework Version: v3.6.0 -CLIVersion: v1.4.0
  • Node Version: v14.15.0

Hello, Thankyou for the amazing framework. I am very much new to maizzle. I have a issue

  1. fetch is not working
  2. customised name tag for loop tag is not working

config.js

module.exports = {
  build: {
    templates: {
      source: "src/templates",
      destination: {
        path: "build_local",
      },
      assets: {
        source: "src/images",
        destination: "images",
      },
      posthtml: {
        expressions: {
          loopTags: ["for"],
        },
      },
    },
  },
  message: "Hello Template",
  fruits: ["apple", "mango", "orange"],
};

test.html(template file)

<extends src="src/layouts/main.html">
    <block name="template">
        <h2 class="text-yellow-600">{{page.message}}</h2>
    </block>
    <block name="temp">
        <h3>Hey Shiva</h3>
        <for loop="item, index in page.fruits">
            <p>{{ item }}, my index is {{index}}</p>
        </for>
        <fetch url="https://jsonplaceholder.typicode.com/users">
            <each loop="user in response">
              {{ user.name }}
            </each>
          </fetch>
    </block>
</extends>
  1. fetch part is not working (i tried both each and for)
  2. It is working with each tag but not with for

Please tell me what i am doing wrong, do i need to install any plugin if yes which one?

package.json

{
  "private": true,
  "scripts": {
    "local": "maizzle build",
    "production": "maizzle build production",
    "watch": "maizzle serve"
  },
  "dependencies": {
    "@maizzle/framework": "^3.0.0"
  }
}

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
cossssmincommented, Jul 19, 2021

Hmm, looks like the posthtml-fetch plugin that provides that functionality is currently broken.

We’ll need to fix that one first, but in the meantime you can use the approach outlined in the WordPress API tutorial:

https://maizzle.com/guides/wordpress-api-posts-email-newsletter/

0reactions
shivakantshukla55commented, Jul 20, 2021

Thankyou very much

Read more comments on GitHub >

github_iconTop Results From Across the Web

Not able fetch the text from svg tag - selenium - Stack Overflow
I can understand you cant provide url but please find below example of svg element. //span[@class='float-left header-icon-left']//*[local-name ...
Read more >
get_the_tags() | Function - WordPress Developer Resources
This function returns an array of objects, one object for each tag assigned to the post. If this function is used in The...
Read more >
Suspense for Data Fetching (Experimental) - React
We call this approach “fetch-on-render” because it doesn't start fetching until after the component has rendered on the screen. This leads to a...
Read more >
How to Create Custom Post Types in WordPress - WPBeginner
Hi, i am a newbie developer trying to create a custom post type. All is good, just 1 huge problem. I want to...
Read more >
5. Working with Arrays and Loops - JavaScript Cookbook [Book]
Not all array elements have to be defined when created. For instance, if you create an array literal, you can use commas to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found