more basic templating, basic config file
This commit is contained in:
parent
229e7a7d33
commit
21c1b06dfc
12 changed files with 72 additions and 7 deletions
7
config/config.yml
Normal file
7
config/config.yml
Normal file
|
@ -0,0 +1,7 @@
|
|||
name: "Nikurasu" # The name on the linktree
|
||||
# profilePic: # uncomment and set this if your profile pic has a custom name
|
||||
links:
|
||||
- text: "YouTube" # text on the link
|
||||
hyperlink: "Test" # the actual hyperlink
|
||||
brandcolor: "youtube" # set this if you want to set the color of the link to the brand color of a platform...
|
||||
color: "#0D0D0D" # or that if you want to set it to an exact color
|
|
@ -12,7 +12,8 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"ejs": "^3.1.8",
|
||||
"express": "^4.18.2"
|
||||
"express": "^4.18.2",
|
||||
"js-yaml": "^4.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"nodemon": "^2.0.20"
|
||||
|
|
BIN
src/assets/img/profilepic.jpg
Normal file
BIN
src/assets/img/profilepic.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 26 KiB |
13
src/index.js
13
src/index.js
|
@ -1,4 +1,8 @@
|
|||
import express from 'express'
|
||||
import yaml from 'js-yaml'
|
||||
import fs, { cpSync } from 'node:fs'
|
||||
|
||||
console.log('🔧 Configuring socialtree...')
|
||||
|
||||
const app = express()
|
||||
const port = 3000
|
||||
|
@ -6,11 +10,16 @@ const engine = 'ejs'
|
|||
|
||||
app.set('view engine', engine)
|
||||
app.set('views', './src/views')
|
||||
app.use(express.static('src/public'))
|
||||
app.use(express.static('src/assets'))
|
||||
|
||||
app.get('/', (req, res) => {
|
||||
let config = yaml.load(fs.readFileSync('config/config.yml'), 'utf8')
|
||||
console.log(JSON.stringify(config))
|
||||
res.render('index', {
|
||||
engine
|
||||
name: config.name,
|
||||
filenameProfilePic: config.profilePic ? config.profilePic : 'profilepic.jpg'
|
||||
})
|
||||
})
|
||||
|
||||
app.listen(port, () => console.log(`App running on port ${port}, with view engine ${engine}`))
|
||||
app.listen(port, () => console.log(`🚀 Socialtree started on port ${port}, with view engine ${engine}`))
|
4
src/public/main.css
Normal file
4
src/public/main.css
Normal file
|
@ -0,0 +1,4 @@
|
|||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
18
src/public/simple-basic.css
Normal file
18
src/public/simple-basic.css
Normal file
|
@ -0,0 +1,18 @@
|
|||
body {
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.container {
|
||||
margin-top: 3rem;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.imgbox>img {
|
||||
height: 10rem;
|
||||
width: 10rem;
|
||||
border-radius: .5rem;
|
||||
}
|
3
src/public/simple-orange.css
Normal file
3
src/public/simple-orange.css
Normal file
|
@ -0,0 +1,3 @@
|
|||
body {
|
||||
background-image: linear-gradient(165deg, #c7a25c 0%, #ff9601 43%, #980d0d 100%);
|
||||
}
|
|
@ -1,4 +1,14 @@
|
|||
<%- include('partials/head') %>
|
||||
<%- include('partials/header') %>
|
||||
<h1>This is a <%= engine %> Template</h1>
|
||||
<div class="container">
|
||||
<div class="imgbox">
|
||||
<img src="img/<%= filenameProfilePic %> " alt="">
|
||||
</div>
|
||||
<div class="headingbox">
|
||||
<span><%= name %></span>
|
||||
</div>
|
||||
<div class="linkbox">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<%- include('partials/footer') %>
|
|
@ -1,4 +1,3 @@
|
|||
<footer>
|
||||
<span>This is the Footer</span>
|
||||
</footer>
|
||||
</html>
|
|
@ -1,5 +1,8 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="main.css">
|
||||
<link rel="stylesheet" href="simple-basic.css">
|
||||
<link rel="stylesheet" href="simple-orange.css">
|
||||
</head>
|
||||
|
|
|
@ -1,3 +1,2 @@
|
|||
<header>
|
||||
<span>This is the header</span>
|
||||
</header>
|
12
yarn.lock
12
yarn.lock
|
@ -30,6 +30,11 @@ anymatch@~3.1.2:
|
|||
normalize-path "^3.0.0"
|
||||
picomatch "^2.0.4"
|
||||
|
||||
argparse@^2.0.1:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38"
|
||||
integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==
|
||||
|
||||
array-flatten@1.1.1:
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-1.1.1.tgz#9a5f699051b1e7073328f2a008968b64ea2955d2"
|
||||
|
@ -405,6 +410,13 @@ jake@^10.8.5:
|
|||
filelist "^1.0.1"
|
||||
minimatch "^3.0.4"
|
||||
|
||||
js-yaml@^4.1.0:
|
||||
version "4.1.0"
|
||||
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602"
|
||||
integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==
|
||||
dependencies:
|
||||
argparse "^2.0.1"
|
||||
|
||||
media-typer@0.3.0:
|
||||
version "0.3.0"
|
||||
resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748"
|
||||
|
|
Loading…
Reference in a new issue