alfred-tailwindcss-docs icon indicating copy to clipboard operation
alfred-tailwindcss-docs copied to clipboard

getting error on the preview window

Open anguila opened this issue 1 year ago • 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

anguila avatar May 31 '23 09:05 anguila

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.

https://github.com/techouse/alfred-tailwindcss-docs/assets/1174328/9b71ad26-feab-449a-94b9-f52e6bf236d7

techouse avatar May 31 '23 20:05 techouse

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

anguila avatar Jul 23 '23 15:07 anguila

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

techouse avatar Jul 23 '23 16:07 techouse