Write-PshtmlAsset will write the asset as file. Add parameter -AsContent to write the contents of the asset directly in the html document instead of the link element.
Details
Assets/JessAssets/JessCssfile.css contents:
table.paleBlueRows {
font-family: "Times New Roman", Times, serif;
border: 1px solid #FFFFFF;
width: 350px;
height: 200px;
text-align: center;
border-collapse: collapse;
}
Example:
Write-PSHTMLAsset -Name "JessAssets"
will add the following in the html document:
<Link rel='stylesheet' type=text/css href='C:/PathToScriptFolder/Assets/JessAssets/JessCssFile.css' >
This works well for cases where these files are available (for webpages or static pages where the folder structure is presenent and accesible).
But for cases where the html page should be sent per email for example, or when the files are not accessible anymore, it would be interessting to have the possibility to write the full content directly into the html document.
cases
.css files
.css files should be outputed into a styles element. like this
<style>
table.paleBlueRows {
font-family: "Times New Roman", Times, serif;
border: 1px solid #FFFFFF;
width: 350px;
height: 200px;
text-align: center;
border-collapse: collapse;
}
</style>
.js
.js files (Asset of type script) shall be exported in a script element as followed
<script>
//Scriptfile content here
</script
Write-PshtmlAssetwill write the asset as file. Add parameter-AsContentto write the contents of the asset directly in the html document instead of the link element.Details
Assets/JessAssets/JessCssfile.css contents:
Example:
will add the following in the html document:
This works well for cases where these files are available (for webpages or static pages where the folder structure is presenent and accesible).
But for cases where the html page should be sent per email for example, or when the files are not accessible anymore, it would be interessting to have the possibility to write the full content directly into the html document.
cases
.css files
.css files should be outputed into a
styleselement. like this.js
.js files (Asset of type
script) shall be exported in ascriptelement as followed