diff --git a/.psscripts/build-functions.ps1 b/.psscripts/build-functions.ps1 index 84791817..4920c373 100644 --- a/.psscripts/build-functions.ps1 +++ b/.psscripts/build-functions.ps1 @@ -2,24 +2,6 @@ # Generic functions # ---------------------------------------------- -function Test-IsMonoInstalled -{ - <# - .DESCRIPTION - Checks to see whether the current environment has the Mono framework installed. - - .EXAMPLE - if (Test-IsMonoInstalled) { Write-Host "Mono is available." } - #> - - try - { - $result = Invoke-Cmd "mono --version" -Silent - return $result.StartsWith("Mono JIT compiler version") - } - catch { return false } -} - function Get-UbuntuVersion { <# @@ -210,32 +192,11 @@ function Get-NetCoreTargetFrameworks ($projFile) Get-TargetFrameworks $projFile | Where-Object { $_ -like "netstandard*" -or $_ -like "netcoreapp*" } } -function Invoke-DotNetCli ($cmd, $proj, $argv) -{ - # Currently dotnet test does not work for net461 on Linux/Mac - # See: https://github.com/Microsoft/vstest/issues/1318 - - if((!($IsWindows) -and !(Test-IsMonoInstalled)) ` - -or (!($IsWindows) -and ($cmd -eq "test"))) - { - $netCoreFrameworks = Get-NetCoreTargetFrameworks($proj) - - foreach($fw in $netCoreFrameworks) { - $fwArgv = "-f $fw " + $argv - Invoke-Cmd "dotnet $cmd $proj $fwArgv" - } - } - else - { - Invoke-Cmd "dotnet $cmd $proj $argv" - } -} - function dotnet-info { Invoke-Cmd "dotnet --info" -Silent } function dotnet-version { Invoke-Cmd "dotnet --version" -Silent } function dotnet-restore ($project, $argv) { Invoke-Cmd "dotnet restore $project $argv" } -function dotnet-build ($project, $argv) { Invoke-DotNetCli -Cmd "build" -Proj $project -Argv $argv } -function dotnet-test ($project, $argv) { Invoke-DotNetCli -Cmd "test" -Proj $project -Argv $argv } +function dotnet-build ($project, $argv) { Invoke-Cmd "dotnet build $project $argv" } +function dotnet-test ($project, $argv) { Invoke-Cmd "dotnet test $project $argv" } function dotnet-run ($project, $argv) { Invoke-Cmd "dotnet run --project $project $argv" } function dotnet-pack ($project, $argv) { Invoke-Cmd "dotnet pack $project $argv" } function dotnet-publish ($project, $argv) { Invoke-Cmd "dotnet publish $project $argv" } diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md index 77facb84..a465d4de 100644 --- a/DOCUMENTATION.md +++ b/DOCUMENTATION.md @@ -38,13 +38,6 @@ An in depth functional reference to all of Giraffe's default features. - [Response Caching](#response-caching) - [Response Compression](#response-compression) - [Giraffe View Engine](#giraffe-view-engine) - - [HTML Elements and Attributes](#html-elements-and-attributes) - - [Text Content](#text-content) - - [Naming Convention](#naming-convention) - - [View Engine Best Practices](#view-engine-best-practices) - - [Custom Elements and Attributes](#custom-elements-and-attributes) - - [Rendering Views](#rendering-views) - - [Common View Engine Features](#common-view-engine-features) - [Serialization](#serialization) - [JSON](#json) - [XML](#xml) @@ -2643,6 +2636,8 @@ dict [ ] ``` +In addition to the `DefaultNegotiationConfig`, there is also a `JsonOnlyNegotiationConfig` provided which only returns JSON. + As you can see from the example above the default dictionary uses the `json` and `xml` http handlers to define the response handler for the respective media types. If a client requests a `text/plain` response then a new function had to be created which accepts an `obj` and uses the `.ToString()` method in combination with the `text` http handler to return a plain text response. If a client has no particular preference (`*/*`) then the default response is `json`. @@ -2918,457 +2913,19 @@ ASP.NET Core has its own [Response Compression Middleware](https://docs.microsof ## Giraffe View Engine -Giraffe has its own functional view engine which can be used to build rich UIs for web applications. The single biggest and best contrast to other view engines (e.g. Razor, Liquid, etc.) is that the Giraffe View Engine is entirely functional written in normal (and compiled) F# code. +Giraffe has its own functional view engine which can be used to build rich UIs for web applications. The single biggest and best contrast to other view engines (e.g. Razor, Liquid, etc.) is that the Giraffe View Engine is entirely functional, written in normal (and compiled) F# code. This means that the Giraffe View Engine is by definition one of the most feature rich view engines available, requires no disk IO to load a view and views are automatically compiled at build time. The Giraffe View Engine uses traditional functions and F# record types to generate rich HTML/XML views. -### HTML Elements and Attributes - -HTML elements and attributes are defined as F# objects: - -```fsharp -let indexView = - html [] [ - head [] [ - title [] [ str "Giraffe Sample" ] - ] - body [] [ - h1 [] [ str "I |> F#" ] - p [ _class "some-css-class"; _id "someId" ] [ - str "Hello World" - ] - ] - ] -``` - -A HTML element can either be a `ParentNode`, a `VoidElement` or a `Text` element. - -For example the `` or `
This is even more text content!
-