tailwindui-crawler icon indicating copy to clipboard operation
tailwindui-crawler copied to clipboard

In Preview, clicking on Code doesn't do anything

Open everynoanysome opened this issue 2 years ago • 7 comments

./output/preview ERROR: While running preview via local server, clicking on <>code tab in components or copying code doesn't work. Is it intended behaviour? currently, due to this - it feels same like finding element on tailwind website or local server and then check for same in vs-codep. can you suggest fix for this?

Suggestion: Also for novice out there, it would be great if you can suggest best practices and how crawler is helpful in local development. currently I'm using this via GitHub copilot to see if I can make improvement easily.

Thanks in advance :)

everynoanysome avatar Jun 11 '23 01:06 everynoanysome

I hadn't used the local preview app in a while, but it looks like Tailwind changed how they structure the JavaScript, causing errors. If you look at the Developer Console, you'll see that the browser is returning CORS errors as it tries to access JS files externally from https://tailwindui.com (since the domain is hardcoded). It works fine running from their domain, just not localhost.

I was hoping I didn't have to process the internal <iframe srcDoc>, but it appears that's the only way to fix this. Anyway, I'll take a look.

kiliman avatar Jun 12 '23 16:06 kiliman

Thanks for quick response. Also can you suggest best practice, suggestions using this repo? (e.g., How professional might get help from local previews? best way to use this inside VSCode? or maybe some Level 100 tips and tricks!!)

everynoanysome avatar Jun 13 '23 01:06 everynoanysome

I hadn't used the local preview app in a while, but it looks like Tailwind changed how they structure the JavaScript, causing errors. If you look at the Developer Console, you'll see that the browser is returning CORS errors as it tries to access JS files externally from https://tailwindui.com (since the domain is hardcoded). It works fine running from their domain, just not localhost.

I was hoping I didn't have to process the internal <iframe srcDoc>, but it appears that's the only way to fix this. Anyway, I'll take a look.

I have the same problem, could you please update it, thank you very much!

bill393 avatar Sep 15 '23 12:09 bill393

Seems like they also remove old .css and .js files from their CDN every version now, hence older copies of my TailwindUI backups not working any more.

VIEWVIEWVIEW avatar Oct 16 '23 15:10 VIEWVIEWVIEW

I've got a preliminary working version. It parses <iframe srcDoc> to find all the external scripts and CSS resources, downloads them locally, and rewrites them as local references.

Still testing, but will publish once it's ready.

kiliman avatar Oct 16 '23 16:10 kiliman

Hi, any news ? :D

MrJuliuss avatar Dec 26 '23 16:12 MrJuliuss

Any news now? ;-)

ag4u avatar May 10 '24 09:05 ag4u