The PSHTMLwebframework builds HTML-Files with PSHTML from native PowerShell-Scripts.
To create the Webframework with PSHTMLwebframework, run the following commands:
- Start VSCode or PowerShell ISE
- git clone https://github.com/tinuwalther/PSHTMLwebframework.git
- git pull
- .\CI\Build-Module.ps1
To build the Home page (index.html), run the following commands:
- Import-Module -Name .\PSHTMLwebframweork.psd1
- Run Publish-WEBHtmlPages
To create a new Webpage from the Template, run the following commands:
- Run New-WEBPage -newpage Page1
- Modify the new Page1.ps1
- Run Publish-WEBHtmlPages
After each changes on one or more Script-Page, you must run Publish-WEBHtmlPages to publish the changes to the HTML-File.
To publish the website on your personal web space:
- Remove the Folder Bin from the PSHTMLwebframweork
- Upload the content of PSHTMLwebframweork to your web space
To change the header, edit the Script header.ps1 in Bin/Includes:
#HomePage
li -Content {
a -href "index.html" -Content {
"Home"
}
}
#NewPages
New pages will be automatically added with the Build-WEBHtmlPages-Command.
To change the footer, edit the Script footer.ps1 in Bin/Includes:
Footer {
div -id "footer" -class "container-fluid" -Content {
hr
$PSHTMLlink = a {"PSHTML"} -href "https://github.com/Stephanevg/PSHTML" -Target _blank
a -href "index.html" -class "badge badge-pill badge-primary" -Content {
"Home"
}
" | Based on $($PSHTMLlink)"
hr
}
}
To modify the Template-Page, edit the Script page.ps1 in Bin/Templates.
Save your images to the folder Assets/IMG and add a new region to your Script-Page:
div -id "img1" -class 'container-fluid' -Content {
img -src "Assets/IMG/words.png" -class "img-thumbnail"
}
To change website styles, edit the style.scc in Style:
body { background: #4CA3DD !important;}
p {
font-family: "QuickSand", sans-serif;
}
h1 {
font-family: "QuickSand", sans-serif;
}
h2 {
font-family: "QuickSand", sans-serif;
}
h3 {
font-family: "QuickSand", sans-serif;
}
table {
font-family: "QuickSand", sans-serif;
}
Div {
margin: 60px;
background: #fdfdfc;
}
img {
max-width:100% ;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: #333;
}
li {
float: left;
}
li a {
display: block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
/* Change the link color to #111 (black) on hover */
li a:hover {
background-color: #111;
}
.active {
background-color: #4CAF50;
}
The PSHTMLwebframework contains the following files and folders:
+---PSHTMLwebframweork
| | index.html
| |
| +---Assets
| | +---BootStrap
| | | bootstrap.min.css
| | | bootstrap.min.js
| | |
| | +---Chartjs
| | | Chart.bundle.min.js
| | | LICENSE.md
| | |
| | +---IMG
| | | words.png
| | |
| | \---Jquery
| | jquery-3.3.1.slim.min.js
| |
| +---Bin
| | | index.ps1
| | | Load-Environment.ps1
| | | PSHTMLwebframweork.psd1
| | | PSHTMLwebframweork.psm1
| | |
| | +---Includes
| | | footer.ps1
| | | header.ps1
| | |
| | \---Templates
| | page.ps1
| |
| \---Style
| style.css