Skip to content

Instantly share code, notes, and snippets.

@Stephanevg
Last active September 7, 2021 07:45
Show Gist options
  • Select an option

  • Save Stephanevg/c9922985ccca8de004f9f3acc217991d to your computer and use it in GitHub Desktop.

Select an option

Save Stephanevg/c9922985ccca8de004f9f3acc217991d to your computer and use it in GitHub Desktop.
To answer your case of having pshtml in functions
Function Write-Header {
$Header =
Head{
'{0}'
'{1}'
}#end of header
$Content1 = Title "Salutations!"
$Content2 =script -src "MyScript.js"
#$REturn =
$Header -f $Content1,$Content2
return $REturn
}
Function Write-Body {
$MyBody = div {
h1 "Main Title"
h2 "SubTitle"
div -Class "Main" -Content {
p {
"plop wop wap"
}
P {
"Paragraph 2"
}
}
}
$Body = Body{
'{0}'
}#End of body
$Body -f $MyBody
}
Function Write-Footer {
$Content = div{
h1 "This is my title"
p {
"Woop"
}
}
$HtmlContent =
Footer{
'{0}'
}#End of footer
return $HtmlContent -f $Content
}
#your Script
Html {
Write-Header
Write-Body
Write-Footer
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment