forked from Zazcallabah/mce
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake.ps1
More file actions
36 lines (33 loc) · 1.2 KB
/
make.ps1
File metadata and controls
36 lines (33 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
function MakePattern( $name )
{
[String]::Format("<script type=""text/javascript"" src=""{0}""></script>", $name)
}
function MakeCss( $name )
{
[String]::Format("<link href=""{0}"" rel=""stylesheet""/>", $name );
}
function ReplaceWithFile( $str, $name ) {
$pattern = MakePattern $name
$filecontents = Get-Content $name
$replacementdata = [String]::Format("<script type=""text/javascript"">{0}</script>" , [String]::Join("`n",$filecontents))
$str.Replace( $pattern, $replacementdata );
}
function ReplaceWithCss( $str, $name ) {
$pattern = MakeCss $name
$filec = Get-Content $name
$repl = [String]::Format("<style type=""text/css"">{0}</style>", [String]::Join("`n",$filec))
$str.Replace( $pattern, $repl );
}
Remove-Item mce.html
Get-Content index.html | Foreach-Object{
$one = ReplaceWithFile $_ "js/knockout.js"
$two = ReplaceWithFile $one "js/storage.js"
$three = ReplaceWithFile $two "js/tools.js"
$four = ReplaceWithFile $three "js/enchantments.js"
$five = ReplaceWithFile $four "js/viewmodel.js"
$six = ReplaceWithFile $five "js/page.js"
$seven = ReplaceWithFile $six "js/mc.js"
$nine = ReplaceWithFile $seven "js/simulation.js"
$ten = ReplaceWithCss $nine "css/bootstrap.min.css"
add-content mce.html $ten
}