Bjorn-Strom / FSS

MIT License
100 stars 4 forks source link

[Question/Proposal] Is it possible to extract compiled CSS to separate file? #13

Closed brud closed 6 months ago

brud commented 2 years ago

Hello, @Bjorn-Strom This is a very cool library, it's exactly what I want!

Is it possible to extract CSS to separate file instead of inlining it in style tag? Where I can/or can't do that? (I'm newby in F#)

Bjorn-Strom commented 2 years ago

Hey, @brud ! I am glad you like it! That is a neat idea! Unfortunately there is no way to do that with any of the libraries. Such a tool could be built around Fss.Core though.

I am currently on vacation so I do not have time to look into it at the moment, but if you want to try it - I can help! It will probably be a good learning experience ☺️

If not I can look into it when I am back from my holiday.

brud commented 2 years ago

Hi, @Bjorn-Strom I would like to try to implement this feature, but I have concerns that my knowledge may not be enough to make it optimal.

On the other hand, if you have any ideas how or where to start - I can try :blush:

Bjorn-Strom commented 2 years ago

Hello again, @brud ! And sorry for the late reply. I have not been able to connect for a couple of days. I have however been thinking about this.

A thing I really like about Fss is how dynamic it is, you can have a function that produces CSS based on input. For example:

let redOrGreen isRed = fss [
      if isRed then
          Color.red
      else
          Color.green
]

And I don't think a tool that produces a style sheet will be able to replicate that.

I do however see a way Fss can be used sort of like SCSS, where it produces a stylesheet that can be imported into any project. Even if that one itself does not use F#.

Have you given any thought as to how this should work? Do you have a specific use-case in mind?

Bjorn-Strom commented 6 months ago

Better late than never 🤓 Closing this with the merging of #38 and the release of Fss.Static and Fss.Builder.