Fable-Fauna / Fable.Flora

Css theme type provider and tools
MIT License
59 stars 3 forks source link

Unable to refence Flora.CssParser in fsx #9

Closed nojaf closed 5 years ago

nojaf commented 5 years ago

Hey, I was giving Flora a spin because well this just looks amazing! However, the following code leads to No constructors are available for type 'Flora.Stylesheet'

let Tailwind = Flora.Stylesheet<"C:\\Temp\\fable-react-lazy-suspense\\public\\styles.css">

How can I know if the problem is related to my css file? Are there any log files I can check?

musheddev commented 5 years ago

The let needs to be a type.

nojaf commented 5 years ago

Wauw yeah obviously, silly me 🙃 Now I get: image

I'm trying to call this from an .fsx script. Repo at tailwind branch. It would be nice to know what is going wrong here.

musheddev commented 5 years ago

I'll look into it. One issue about type providers is they get executed by visual studio and F# compiler. Thus referencing their dependencies can get tricky. Which may be why it doesn't work in the script.

musheddev commented 5 years ago

Quick Fix: you can copy FSharp.Core and Flora.CssParser into the Flora.CssProvider lib C:\Users\Orlando\.nuget\packages\flora.cssprovider\0.6.0\lib\netstandard2.0 like so (or where ever paket places them).

After reading and looking around at other type providers I need to repackage the nuget to include them. Expect a 0.6.1 in the next few days to fix that. (Which means lavishly changing my fake script)

nojaf commented 5 years ago

Copying those dlls does make the error go away. It doesn't really handle my css file well. I barely get IntelliSense probably due to the file size though.

musheddev commented 5 years ago

Yeah, I noticed it. It is an Ionide issue though, after an initial two second parse time it is snippy in VS. I haven't tried with Ionide 4 yet.

musheddev commented 5 years ago

Pushed 0.6.1 with the added assemblies.

nojaf commented 5 years ago

0.6.1 fixed the problem. I still don't get any proper intelliSense with my custom tailwind file. It fails in Rider, super slow in Ionide (but eventually works) and I get an error in VS 17. image

musheddev commented 5 years ago

I suppose that is because I was in VS 2019 with the 4.6 version of the fsharp compiler. I'll look into it, but I don't have a lot of confidence that I can fix this one.

musheddev commented 5 years ago

I get about a 1.5 sec intelliSense delay in ionide-experimental and vs2019.

nojaf commented 5 years ago

Ok, thanks for the effort.

musheddev commented 5 years ago

Good news, I was able to speed things up dramatically with a concurrent cache in the type provider.