kiliman / tailwindui-crawler

tailwindui-crawler downloads the component HTML files locally
MIT License
756 stars 94 forks source link

In Preview, clicking on Code doesn't do anything #79

Open everynoanysome opened 1 year ago

everynoanysome commented 1 year ago

./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 :)

kiliman commented 1 year ago

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.

everynoanysome commented 1 year ago

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!!)

bill393 commented 10 months ago

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!

VIEWVIEWVIEW commented 9 months ago

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.

kiliman commented 9 months ago

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.

MrJuliuss commented 7 months ago

Hi, any news ? :D

ag4u commented 2 months ago

Any news now? ;-)