mirror of
https://github.com/arnaucube/konstrui.git
synced 2026-02-07 03:26:43 +01:00
implemented copy files in directories without templating, with concurrency in all subdirectories
This commit is contained in:
@@ -1,59 +0,0 @@
|
|||||||
.collection{
|
|
||||||
border: 0!important;
|
|
||||||
}
|
|
||||||
.collection-item{
|
|
||||||
background-color: rgba(0,0,0,0)!important;
|
|
||||||
border: 0px!important;
|
|
||||||
}
|
|
||||||
.collection-item:hover{
|
|
||||||
background-color: rgba(255,255,255,0.1)!important;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* login */
|
|
||||||
.o_loginBackground{
|
|
||||||
position: absolute;
|
|
||||||
|
|
||||||
height: 100%!important;
|
|
||||||
width: 100%;
|
|
||||||
min-height: auto;
|
|
||||||
-webkit-background-size: cover;
|
|
||||||
-moz-background-size: cover;
|
|
||||||
background-size: cover;
|
|
||||||
-o-background-size: cover;
|
|
||||||
background-position: center;
|
|
||||||
background-image: url('img/loginBackground.jpg');
|
|
||||||
text-align: center;
|
|
||||||
/*color: white;*/
|
|
||||||
|
|
||||||
/* Create the parallax scrolling effect */
|
|
||||||
background-attachment: fixed;
|
|
||||||
background-position: center;
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
background-size: cover;
|
|
||||||
|
|
||||||
color: #ffffff;
|
|
||||||
|
|
||||||
}
|
|
||||||
@font-face {
|
|
||||||
font-family: 'Otterly Adorable';
|
|
||||||
src: url('fonts/fourHand_TRIAL.ttf');
|
|
||||||
}
|
|
||||||
.o_loginBackground h1{
|
|
||||||
color: #ffffff!important;
|
|
||||||
margin: 10px;
|
|
||||||
font-family: 'Otterly Adorable'
|
|
||||||
/*font-weight: bold;*/
|
|
||||||
}
|
|
||||||
|
|
||||||
.o_floatRight{
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
.o_textRight{
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
.o_badge{
|
|
||||||
border-radius: 8px;
|
|
||||||
margin: 5px;
|
|
||||||
padding: 2px 5px;
|
|
||||||
}
|
|
||||||
1
example/webInput/css/app.css
Normal file
1
example/webInput/css/app.css
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/* here the style */
|
||||||
1
example/webInput/css/colors.css
Normal file
1
example/webInput/css/colors.css
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/* here the style of colours */
|
||||||
1
example/webInput/js/scripts1.js
Normal file
1
example/webInput/js/scripts1.js
Normal file
@@ -0,0 +1 @@
|
|||||||
|
//here scripts
|
||||||
1
example/webInput/js/scripts2.js
Normal file
1
example/webInput/js/scripts2.js
Normal file
@@ -0,0 +1 @@
|
|||||||
|
//here scripts 2
|
||||||
@@ -5,11 +5,14 @@
|
|||||||
"website": "arnaucode.com",
|
"website": "arnaucode.com",
|
||||||
"files": [
|
"files": [
|
||||||
"index.html",
|
"index.html",
|
||||||
"projects.html",
|
"projects.html"
|
||||||
"app.css"
|
|
||||||
],
|
],
|
||||||
"repeatPages": [{
|
"repeatPages": [{
|
||||||
"htmlPage": "projectPage.html",
|
"htmlPage": "projectPage.html",
|
||||||
"data": "templates/projectTemplate.json"
|
"data": "templates/projectTemplate.json"
|
||||||
}]
|
}],
|
||||||
}
|
"copyRaw": [
|
||||||
|
"css",
|
||||||
|
"js"
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,59 +0,0 @@
|
|||||||
.collection{
|
|
||||||
border: 0!important;
|
|
||||||
}
|
|
||||||
.collection-item{
|
|
||||||
background-color: rgba(0,0,0,0)!important;
|
|
||||||
border: 0px!important;
|
|
||||||
}
|
|
||||||
.collection-item:hover{
|
|
||||||
background-color: rgba(255,255,255,0.1)!important;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* login */
|
|
||||||
.o_loginBackground{
|
|
||||||
position: absolute;
|
|
||||||
|
|
||||||
height: 100%!important;
|
|
||||||
width: 100%;
|
|
||||||
min-height: auto;
|
|
||||||
-webkit-background-size: cover;
|
|
||||||
-moz-background-size: cover;
|
|
||||||
background-size: cover;
|
|
||||||
-o-background-size: cover;
|
|
||||||
background-position: center;
|
|
||||||
background-image: url('img/loginBackground.jpg');
|
|
||||||
text-align: center;
|
|
||||||
/*color: white;*/
|
|
||||||
|
|
||||||
/* Create the parallax scrolling effect */
|
|
||||||
background-attachment: fixed;
|
|
||||||
background-position: center;
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
background-size: cover;
|
|
||||||
|
|
||||||
color: #ffffff;
|
|
||||||
|
|
||||||
}
|
|
||||||
@font-face {
|
|
||||||
font-family: 'Otterly Adorable';
|
|
||||||
src: url('fonts/fourHand_TRIAL.ttf');
|
|
||||||
}
|
|
||||||
.o_loginBackground h1{
|
|
||||||
color: #ffffff!important;
|
|
||||||
margin: 10px;
|
|
||||||
font-family: 'Otterly Adorable'
|
|
||||||
/*font-weight: bold;*/
|
|
||||||
}
|
|
||||||
|
|
||||||
.o_floatRight{
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
.o_textRight{
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
.o_badge{
|
|
||||||
border-radius: 8px;
|
|
||||||
margin: 5px;
|
|
||||||
padding: 2px 5px;
|
|
||||||
}
|
|
||||||
1
example/webOutput/css/app.css
Normal file
1
example/webOutput/css/app.css
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/* here the style */
|
||||||
1
example/webOutput/css/colors.css
Normal file
1
example/webOutput/css/colors.css
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/* here the style of colours */
|
||||||
1
example/webOutput/js/scripts1.js
Normal file
1
example/webOutput/js/scripts1.js
Normal file
@@ -0,0 +1 @@
|
|||||||
|
//here scripts
|
||||||
1
example/webOutput/js/scripts2.js
Normal file
1
example/webOutput/js/scripts2.js
Normal file
@@ -0,0 +1 @@
|
|||||||
|
//here scripts 2
|
||||||
42
main.go
42
main.go
@@ -35,6 +35,7 @@ func parseDir(folderPath string, newDir string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
func startTemplating(folderPath string, newDir string) {
|
func startTemplating(folderPath string, newDir string) {
|
||||||
|
//do templating for each file in konstruiConfig.Files in konstruiConfig.Files
|
||||||
for i := 0; i < len(konstruiConfig.Files); i++ {
|
for i := 0; i < len(konstruiConfig.Files); i++ {
|
||||||
fName := konstruiConfig.Files[i]
|
fName := konstruiConfig.Files[i]
|
||||||
fileNameSplitted := strings.Split(fName, ".")
|
fileNameSplitted := strings.Split(fName, ".")
|
||||||
@@ -49,6 +50,7 @@ func startTemplating(folderPath string, newDir string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//do templating for the file pages in konstruiConfig.RepeatPages
|
||||||
c.Cyan("starting to generate Pages to repeat")
|
c.Cyan("starting to generate Pages to repeat")
|
||||||
for i := 0; i < len(konstruiConfig.RepeatPages); i++ {
|
for i := 0; i < len(konstruiConfig.RepeatPages); i++ {
|
||||||
pageTemplate, data := getHtmlAndDataFromRepeatPages(konstruiConfig.RepeatPages[i])
|
pageTemplate, data := getHtmlAndDataFromRepeatPages(konstruiConfig.RepeatPages[i])
|
||||||
@@ -59,15 +61,53 @@ func startTemplating(folderPath string, newDir string) {
|
|||||||
writeFile(newDir+"/"+data[j]["pageName"]+"Page.html", generatedPage)
|
writeFile(newDir+"/"+data[j]["pageName"]+"Page.html", generatedPage)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//copy the konstruiConfig.CopyRaw files without modificate them
|
||||||
|
for i := 0; i < len(konstruiConfig.CopyRaw); i++ {
|
||||||
|
fName := konstruiConfig.CopyRaw[i]
|
||||||
|
c.Yellow(fName)
|
||||||
|
fileNameSplitted := strings.Split(fName, ".")
|
||||||
|
if len(fileNameSplitted) > 1 {
|
||||||
|
//is a file
|
||||||
|
copyFileRaw(folderPath, fName, newDir)
|
||||||
|
} else {
|
||||||
|
//is a directory
|
||||||
|
c.Red(folderPath + "/" + fName)
|
||||||
|
copyDirRaw(folderPath, fName, newDir)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func copyDirRaw(fromDir string, currentDir string, newDir string) {
|
||||||
|
filesList, _ := ioutil.ReadDir("./" + fromDir + "/" + currentDir)
|
||||||
|
fmt.Println(fromDir + "/" + currentDir)
|
||||||
|
c.Green(newDir + "/" + currentDir)
|
||||||
|
os.MkdirAll(newDir+"/"+currentDir, os.ModePerm)
|
||||||
|
for _, f := range filesList {
|
||||||
|
fileNameSplitted := strings.Split(f.Name(), ".")
|
||||||
|
if len(fileNameSplitted) > 1 {
|
||||||
|
//is a file
|
||||||
|
copyFileRaw(fromDir+"/"+currentDir, f.Name(), newDir+"/"+currentDir)
|
||||||
|
} else {
|
||||||
|
//is a directory
|
||||||
|
copyDirRaw(fromDir+"/"+currentDir, f.Name(), newDir+"/"+currentDir)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func copyFileRaw(fromDir string, fName string, newDir string) {
|
||||||
|
c.Yellow("copying raw " + fromDir + "//" + fName)
|
||||||
|
fileContent := readFile(fromDir + "/" + fName)
|
||||||
|
writeFile(newDir+"/"+fName, fileContent)
|
||||||
}
|
}
|
||||||
func main() {
|
func main() {
|
||||||
c.Green("getting files from /webInput")
|
c.Green("getting files from /webInput")
|
||||||
c.Green("getting conifg from file konstruiConfig.json")
|
c.Green("getting conifg from file konstruiConfig.json")
|
||||||
|
//first reads the konstrui.Config.json
|
||||||
readKonstruiConfig(rawFolderPath + "/" + konstruiConfigFile)
|
readKonstruiConfig(rawFolderPath + "/" + konstruiConfigFile)
|
||||||
c.Green("configuration:")
|
c.Green("configuration:")
|
||||||
fmt.Println(konstruiConfig.Files)
|
fmt.Println(konstruiConfig.Files)
|
||||||
c.Green("templating")
|
c.Green("templating")
|
||||||
//parseDir(rawFolderPath, newFolderPath)
|
//parseDir(rawFolderPath, newFolderPath)
|
||||||
|
|
||||||
startTemplating(rawFolderPath, newFolderPath)
|
startTemplating(rawFolderPath, newFolderPath)
|
||||||
c.Green("webpage finished, wiles at /webOutput")
|
c.Green("webpage finished, files at /webOutput")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ type KonstruiConfig struct {
|
|||||||
Website string `json:"website"`
|
Website string `json:"website"`
|
||||||
Files []string `json:"files"`
|
Files []string `json:"files"`
|
||||||
RepeatPages []RepeatPages
|
RepeatPages []RepeatPages
|
||||||
|
CopyRaw []string `json:"copyRaw"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var konstruiConfig KonstruiConfig
|
var konstruiConfig KonstruiConfig
|
||||||
|
|||||||
Reference in New Issue
Block a user