giraffe-fsharp / giraffe.viewengine Goto Github PK
View Code? Open in Web Editor NEWAn F# view engine for Giraffe and other ASP.NET Core web applications.
License: Apache License 2.0
An F# view engine for Giraffe and other ASP.NET Core web applications.
License: Apache License 2.0
I am converting a HTML hard coded website to Giraffe (for layout, data templating...). It is quite boring to transform HTML to function-style view. I thought a tool could help, an XSLT stylesheet would do the job, any ideas about that ? existing tool in other equiv framework ?
just a proposal/suggestion: Feliz Synthax is way more straight forward for HTML templating,
https://github.com/Zaid-Ajaj/Feliz
instead of writing (or as an alternative, e.g. ViewEngine.FelizStyle?)
div [ ] [
div [ ] [ text "hello" ]
]
we could write
Html.div [
prop.children [
Html.div "hello"
]
]
but maybe is very complex to implement
The function strf
is implemented incorrectly and can't actually take format arguments. It needs to use kprintf
to work.
RenderView.AsString.htmlDocument
does not permit to render formatted html documents.
It would be good to be able to read generated result.
Sometimes I want a partial that returns more than one HTML element, so it returns a list. But, if I want to use that as a child node along with other elements, it's not possible because a list can only hold values of the same type.
Is it possible to make a fragment (as it's called in react), that will not render any unnecessary markup, that one could wrap a list of elements in?
Sure, I could do this by concatenating lists, but that would make the code a bit more unreadable.
let textField name =
label [_for name] [ste "My label"]
input [_type "text" _name name ]
let myForm = form [_method "post" _action "/endpoint"][
textField "name"
button [_type "submit" ][str "send"]
]
This will obviously not work, and I would rather not have to wrap textField in an unnecessary div, or concatenate.
Is it possible to make an empty tag, that will not actually produce any markup to get around this?
let textField name =
fragment [] [
label [_for name] [ste "My label"]
input [_type "text" _name name ]
]
let myForm = form [_method "post" _action "/endpoint"][
textField "name"
button [_type "submit" ][str "send"]
]
Hi there,
I know its legacy stuff and maybe much to ask, but is there the possibility of adopting a strong name for this package?
I maintain a graphing library, Plotly.NET, which is a strong named DLL. I forgot about that legacy stuff when updating my html generation backend to use this package, and now people on netfx face these problems: plotly/Plotly.NET#371
Another solution would be copying the two source files of Giraffe.ViewEngine into our project. That would have the advantage of not asking you to do anything, but the disadvantage of not attributing any package downloads. Would that be something you'd allow (IANAL but i think your license allows this, i think it would still be better to ask as well)?
@Krzysztof-Cieslak @dustinmoris @bradder555 Just to say this is great and thanks for getting this to 1.0, it's an important reusable component.
(If you ever want to rename it into FSharp.Web.ViewEngine
or something I'd support that as I consider it pretty much canonical in the F# universe, at least server-side, though I'm not particularly asking for that)
When I do str "»"
(or if I generally am passing a string with HTML entities), the rendered HTML (as viewed in the browser) does not contain »
, but »
. Is that how it's supposed to work? Do I have to expand HTML entities everywhere myself, or at least define an alias of str
that does that? Are there security reasons for this, perhaps?
Hi,
Was just playing around with the library. In this section https://github.com/giraffe-fsharp/Giraffe.ViewEngine#rendering-xml , it appears those render functions do not exist. Is the documentation out of date?
Thanks,
Nat
If we have a backlog / kanban of some sort myself and others can assist with bug fixes, features, etc...
Would be nice to have a gitter/slack/discord... for contributors to discuss features & decisions.
Hi there, awesome library! I am using it in various projects.
Would it be possible to support netstandard2.0 as well? I would love to use the html DSL for generation of the file scaffold for rendering plots in Plotly.NET, it would make that part of the library way easier to customize and adapt. We plan to move to .net5 eventually, but so far we are stuck on netstandard2.0 and it would be awesome if you would consider supporting it if there are no major blockers. Cheers!
When you have a moment, a version with the Microsoft.SourceLink.Github
PackageReference would be great :) Giraffe proper is sourcelinked, I think it just got lost in the shuffle here.
Thanks @dustinmoris for all the work you've put in since my contribution in May.
It's looking very slick and polished now.
It'll be nice to see a cleaner commit history (most of which can be achieved with git rebase squash etc). This will help if we're ever going through the history to work out why a decision was made.
I'm happy to volunteer as a reviewer; I think you'll get more engagement from me this way too.
Since the whole github pipeline has been configured, do you think it's worth incorporating LGTM?
https://github.com/lgtmco/lgtm
Regards
Brad
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.