-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·65 lines (49 loc) · 1.69 KB
/
build.sh
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env sh
### -- INITIALISATION STAGE --
# Exit on fail
set -e
# Create the build directory, clearing the old one
rm -rf build; mkdir -p build
## -- Server root --
echo "Copying to site root..."
# Copy all files in the root of src/pages (not directories) into build/
find src -maxdepth 1 -type f | while read -r file; do
# Extract the filename
filename=$(basename "$file")
# Copy the file to the build directory
cp "$file" "build/$filename"
echo "Copied $file -> build/$filename"
done
### -- RENDER STAGE --
## -- Velox --
echo "Building Vel pages..."
# Find all .vtml files in src/pages recursively
# find src/pages -type f -name "*.vtml" | while read -r file; do
find src/pages -type f -name "*.html" | while read -r file; do
# Remove the "src/pages/" prefix to get the relative path
relative_path="${file#src/pages/}"
# Generate the output path in the build directory (preserving structure)
# output="build/${relative_path%.vtml}.html"
output="build/${relative_path%.html}.html"
# Ensure the output directory exists
mkdir -p "$(dirname "$output")"
# Process the file with velox and output to the build directory
./velox -c ./src/components "$file" > "$output"
echo "Built $file -> $output"
done
# ## -- SCSS --
# echo "Building SCSS..."
#
# # Find all .scss files in src/css recursively
# find src/css -type f -name "*.scss" | while read -r file; do
# # Extract the filename from the path
# filename=$(basename "$file")
#
# # Generate the output path in the build directory
# output="build/css/${filename%.scss}.css"
#
# # Process the file with the sass cli and output to the build directory
# sass "$file" "$output"
#
# echo "Built $file -> $output"
# done