-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fb90027
commit ecc8720
Showing
6 changed files
with
138 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package builder | ||
|
||
import ( | ||
"io" | ||
"os" | ||
"path/filepath" | ||
"strings" | ||
) | ||
|
||
func CopyStaticFiles(sourceDir, destinationDir string) error { | ||
if _, err := os.Stat(sourceDir); os.IsNotExist(err) { | ||
return err | ||
} | ||
if _, err := os.Stat(destinationDir); os.IsNotExist(err) { | ||
if err := os.MkdirAll(destinationDir, 0755); err != nil { | ||
return err | ||
} | ||
} | ||
err := filepath.Walk(sourceDir, func(path string, info os.FileInfo, err error) error { | ||
if err != nil { | ||
return err | ||
} | ||
if !info.IsDir() && (strings.HasSuffix(path, ".html") || strings.HasSuffix(path, ".css")) { | ||
sourceFile, err := os.Open(path) | ||
if err != nil { | ||
return err | ||
} | ||
defer sourceFile.Close() | ||
destinationFile, err := os.Create(filepath.Join(destinationDir, info.Name())) | ||
if err != nil { | ||
return err | ||
} | ||
defer destinationFile.Close() | ||
_, err = io.Copy(destinationFile, sourceFile) | ||
if err != nil { | ||
return err | ||
} | ||
} | ||
return nil | ||
}) | ||
if err != nil { | ||
return err | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
@import url("../layout.css"); | ||
@import url('../reset.css'); | ||
@import url('../global.css'); | ||
|
||
.not_found { | ||
margin: 0 auto; | ||
max-width: 800px; | ||
padding: 0 1rem; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<!DOCTYPE html> | ||
<html lang="en-us"> | ||
<head> | ||
<meta charset="utf-8"/> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"/> | ||
<!-- Generated path --> | ||
<link rel="stylesheet" href="./404.css"> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<div class="content"> | ||
<h1 class="not_found">Page Not Found</h1> | ||
</div> | ||
<footer class="footer"> | ||
<ul class="footer__links"> | ||
<li class="footer__links_item"> | ||
<a href="/" class="footer__links__item__link">Home</a> | ||
</li> | ||
<li class="footer__links_item"> | ||
<a href="/about" class="footer__links__item__link">About</a> | ||
</li> | ||
<li class="footer__links_item"> | ||
<a href="/rss.xml" class="footer__links__item__link">RSS Feed</a> | ||
</li> | ||
<li class="footer__links_item"> | ||
<span class="footer__copy-right">© 2021 K-Sato</span> | ||
</li> | ||
</ul> | ||
</footer> | ||
|
||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
@import url("../layout.css"); | ||
@import url('../reset.css'); | ||
@import url('../global.css'); | ||
|
||
|
||
.about__title { | ||
margin: 0 auto; | ||
font-size: 2rem; | ||
margin: 1rem 0; | ||
} | ||
|
||
.about__descr { | ||
margin: 1rem 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<!DOCTYPE html> | ||
<html lang="en-us"> | ||
<head> | ||
<meta charset="utf-8"/> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"/> | ||
<!-- Generated path --> | ||
<link rel="stylesheet" href="./about.css"> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<div class="content"> | ||
<h1 class="about_title">About me</h1> | ||
<p class="about_desc">Software Engineer</p> | ||
</div> | ||
<footer class="footer"> | ||
<ul class="footer__links"> | ||
<li class="footer__links_item"> | ||
<a href="/" class="footer__links__item__link">Home</a> | ||
</li> | ||
<li class="footer__links_item"> | ||
<a href="/about" class="footer__links__item__link">About</a> | ||
</li> | ||
<li class="footer__links_item"> | ||
<a href="/rss.xml" class="footer__links__item__link">RSS Feed</a> | ||
</li> | ||
<li class="footer__links_item"> | ||
<span class="footer__copy-right">© 2021 Yourname</span> | ||
</li> | ||
</ul> | ||
</footer> | ||
|
||
</div> | ||
</body> | ||
</html> |