nhoizey / jekyll-cloudinary

Jekyll plugin adding a Liquid tag for Cloudinary, for better responsive images
https://nhoizey.github.io/jekyll-cloudinary/
MIT License
90 stars 18 forks source link

only_prod doesn't work as expected #84

Open gamue opened 4 years ago

gamue commented 4 years ago

First of all, thanks for the great plugin 👍

When I set only_prod: true the prod-code which gets created doesn't contain the cloudinary tags and uses the local images, which forces me to touch that setting every time I do changes on the page.

For compilation I'm using https://github.com/helaili/jekyll-action

Another minor thing: With only_prod: false the local images aren't getting loaded using 127.0.0.1:4000, which shows up as a link in the console. I need to change it to localhost:4000 that they are shown.

nhoizey commented 4 years ago

First of all, thanks for the great plugin 👍

Thanks, it's nice having such positive feedback!

When I set only_prod: true the prod-code which gets created doesn't contain the cloudinary tags and uses the local images, which forces me to touch that setting every time I do changes on the page.

For compilation I'm using https://github.com/helaili/jekyll-action

Does it allow you to set JEKYLL_ENV=production before the build command, which is required with only_prod: true?

Another minor thing: With only_prod: false the local images aren't getting loaded using 127.0.0.1:4000, which shows up as a link in the console. I need to change it to localhost:4000 that they are shown.

That's strange, 127.0.0.1 and localhost should be the same, unless you use a local proxy or a specific HTTP server.

gamue commented 4 years ago

That's strange, 127.0.0.1 and localhost should be the same, unless you use a local proxy or a specific HTTP server.

Might be because of I'm using Win10, not that big issue though

Does it allow you to set JEKYLL_ENV=production before the build command, which is required with only_prod: true?

Yes, it actually directly sets it directly at the build call. When checking the code and compare it with other plugins and themes I'm wondering why you are not using jekyll.environment == 'production' for the check.

nhoizey commented 4 years ago

That's strange, 127.0.0.1 and localhost should be the same, unless you use a local proxy or a specific HTTP server.

Might be because of I'm using Win10, not that big issue though

Ok

Does it allow you to set JEKYLL_ENV=production before the build command, which is required with only_prod: true?

Yes, it actually directly sets it directly at the build call.

Indeed.

When checking the code and compare it with other plugins and themes I'm wondering why you are not using jekyll.environment == 'production' for the check.

Good question.

I guess I mixed the environment variable declaration and the environment check inside the code… 🤔

I have to read https://jekyllrb.com/docs/configuration/environments/ and fix this…