strapi-community / jekyll-strapi

Jekyll plugin to retrieve content from any Strapi API.
https://strapi.io
MIT License
57 stars 30 forks source link

Endless loop when using strapi images with livereload #33

Open paulkitt opened 2 years ago

paulkitt commented 2 years ago

When starting jekyll with the live reload option and using media assets from strapi a endless loop is created.

I think when the reload is triggered the strapi plugin is fetching the images again to the tmp_assets folder which triggers a reload again and so on.

I tried to ignore and exclude the tmp_assets folder but no success.

Anybody any idea how to get livereload working with strapi?

....
destination: public

# Build settings
theme: minima
plugins:
  - jekyll-feed
  - jekyll-strapi-4

strapi:
    # Your API endpoint (optional, default to http://localhost:1337)
    endpoint: http://localhost:1337
    # Collections, key is used to access in the strapi.collections
    # template variable
    collections:
      landingpage:
        type: landingpages
        populate: deep

livereload_ignore: [_tmp_assets]

exclude:
  - tmp_assets
  - .git/
  - .sass-cache/
  - .jekyll-cache/
  - gemfiles/
  - Gemfile
  - Gemfile.lock
  - node_modules/
  - vendor
  - webpack*
  - yarn*
  - package.json
bundle exec jekyll serve --livereload --trace 
Configuration file: /path/to/jekyll/cb/cb-frontend/_config.yml
            Source: /path/to/jekyll/cb/cb-frontend
       Destination: /path/to/jekyll/cb/cb-frontend/public
 Incremental build: disabled. Enable with --incremental
      Generating... 
       Jekyll Feed: Generating feed for posts
 Jekyll StrapiHTTP: Fetching entries from http://localhost:1337/api/landingpages using headers: ["Authorization"]
 Jekyll StrapiHTTP: Fetching entries from http://localhost:1337/api/landingpages/2?populate=deep using headers: ["Authorization"]
                    done in 2.275 seconds.
 Auto-regeneration: enabled for '/home/hans/Documents/kollektiv/git_repositories/jekyll/cb/cb-frontend'
LiveReload address: http://127.0.0.1:35729
    Server address: http://127.0.0.1:4000/
  Server running... press ctrl-c to stop.
      Regenerating: 1 file(s) changed at 2022-09-27 18:17:13
                    index.html
       Jekyll Feed: Generating feed for posts
 Jekyll StrapiHTTP: Fetching entries from http://localhost:1337/api/landingpages using headers: ["Authorization"]
 Jekyll StrapiHTTP: Fetching entries from http://localhost:1337/api/landingpages/2?populate=deep using headers: ["Authorization"]
             Error: wrong number of arguments (given 1, expected 2)
             Error: Run jekyll build --trace for more information.

      Regenerating: 1 file(s) changed at 2022-09-27 18:17:15
                    _tmp_assets/large_C-B_Header.png
       Jekyll Feed: Generating feed for posts
 Jekyll StrapiHTTP: Fetching entries from http://localhost:1337/api/landingpages using headers: ["Authorization"]
 Jekyll StrapiHTTP: Fetching entries from http://localhost:1337/api/landingpages/2?populate=deep using headers: ["Authorization"]
             Error: wrong number of arguments (given 1, expected 2)
             Error: Run jekyll build --trace for more information.
bluszcz commented 2 years ago

Hello, thank you for your bug report. I am not experiencing this issue in my configuration, or I misunderstood. @mkrajewski90 perhaps something with populate "deep"?