hugo-quiz icon indicating copy to clipboard operation
hugo-quiz copied to clipboard

CDN issue

Open eyal7773 opened this issue 1 year ago • 2 comments

Hello,

I successfully integrated 'hugo-quiz' into my website. However, I encountered an issue I'd like to address. Despite using Hugo without minification for the quiz-specific pages, I faced corruption problems in the production environment due to the CDN (CloudFlare).

I resolved this by configuring CloudFlare "Page Rules" to disable "Performance" for these pages.

However, I believe it would be more effective if this issue could be resolved on your end. Perhaps allowing the option to pass a JSON array with the questions instead of relying on Markdown could be a viable solution.

eyal7773 avatar Oct 03 '23 09:10 eyal7773

Related to this. It'd be great if we could still use minification when using the shortcode. @eyal7773, how did you disable minification on specific pages?

In addition, I'm also using Cloudflare Pages to deploy my site, but everything is fine on my side as long as I disable HTML minification.

rodrigoalcarazdelaosa avatar Oct 07 '23 07:10 rodrigoalcarazdelaosa

Related to this. It'd be great if we could still use minification when using the shortcode. @eyal7773, how did you disable minification on specific pages?

In addition, I'm also using Cloudflare Pages to deploy my site, but everything is fine on my side as long as I disable HTML minification.

Hi @rodrigoalcarazdelaosa , To hack the minification issue, I wrote a small script, which do the "hugo" compiling process twice :

  • Once without minification (using the cli option --config SOME_FILE
  • Then Copy the relevant articles to side folder
  • Then run hugo again - but with minification.
  • And then copy the relevant articles to the published folder, instead of the minified files.
#!/bin/bash
echo "-------- BUILD WITHOUT MINIFY --- JUST FOR TESTS FOLDER ----"
hugo --gc --cleanDestinationDir --config config-no-minify.yml
echo "-------- COPY the test folder aside, to use it later -------"
cp -r ./public/someFolder  ../tmp-tests
echo "-------- BUILD WITH MINIFY ---------------------------------"
hugo --gc --cleanDestinationDir --minify
echo "-------- COPY the not-minified tests -----------------------"
cp -r ../tmp-tests/tests/ ./public/someFolder/

And the config-no-minify.yml file , include this lines :



minify:
  disableXML: false
  minifyOutput: false

Hope it will help you.

eyal7773 avatar Oct 08 '23 14:10 eyal7773

Thanks! Let's continue discussion here: https://github.com/bonartm/quizdown-js/issues/53

bonartm avatar Oct 11 '24 07:10 bonartm