techouse/alfred-tailwindcss-docs

getting error on the preview window

Opened this issue · 3 comments

Hi!
Thanks for sharing this workflow!

I'm getting the following error when opening the preview via cmd Y:

It seems to start to load the page but then it turns into this:
image

Many thanks,

David

Hey!

Thanks for reporting. This looks like a website error as the page is simply a website link. Kinda odd behaviour though. Need to dig deeper, even though I'm not sure there's anything I can do tbh.

Screen.Recording.2023-05-31.at.21.13.09.mov

I just realised that issue seems to be happening only with branch v3 (default). if you use v0, v1 or v2 it actually does work. So there's some kind of problem with v3's website.

So as a quick workaround I just changed the script filter to include the branch v2 in it, so I don't have to type it every time:

image

Hope that helps anyone with that issue.

Best,

David

I did some digging on how this actually works on macOS.

Turns out this is all done by qlmanage. The problem is that qlmanage on its own can not load webpages. After digging deeper I found this hacky approach.

So one has to make a Property List, like so

/usr/libexec/PlistBuddy \
-c 'add :URL string "https://tailwindcss.com/docs/flex\#content-wrapper"' \
tailwind.webloc

which produces

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>URL</key>
    <string>https://tailwindcss.com/docs/flex#content-wrapper</string>
</dict>
</plist>

and then open that using

qlmanage -p tailwind.webloc

this produces the same error and I can't get the console of the browser to work. 🤪

And like you've observed above, v2 works fine, i.e.

/usr/libexec/PlistBuddy \
-c 'add :URL string "https://v2.tailwindcss.com/docs/transition-duration\#content-wrapper"' \
tailwind2.webloc \
&& qlmanage -p tailwind2.webloc