Templator Init

This commit is contained in:
2025-04-01 08:51:14 -05:00
commit de01705e40
4 changed files with 46 additions and 0 deletions

5
README.md Normal file
View File

@@ -0,0 +1,5 @@
# CBTE (Crude Bash Templating Engine)
This is a template engine to wrap html, css, and js, all into one smaller html file.
This was made for making google scripts apps.

4
cleanup_build.sh Normal file
View File

@@ -0,0 +1,4 @@
echo "Running Cleanup"
rm -rf script.js script.min.js &&
rm -rf styles.css styles.css.map styles.min.css &&
echo "Cleanup Done"

24
compile.sh Normal file
View File

@@ -0,0 +1,24 @@
#! /bin/bash
# This is a ver y crude templating engine build in bash
# The input files are:
# src/
# - index.dev.html
# script.js
# styles.css
#
# All these files are bundled into:
# index.html
build_dest=build/index.html
key_js_line=$(awk '/<script replaceMe><\/script>/ {print NR}' ./src/index.dev.html)
jsReplace=$(head -n $[$key_js_line - 1] ./src/index.dev.html && echo "<script>" && cat ./script.js && echo "</script>" && tail -n +$[key_js_line + 1] ./src/index.dev.html)
echo "$jsReplace" > $build_dest
key_css_line=$(awk '/<style replaceMe><\/style>/ {print NR}' ./$build_dest)
cssReplace=$(head -n $[$key_css_line - 1] ./$build_dest && echo "<style>" && cat ./styles.css && echo "</style>" && tail -n +$[key_css_line + 1] ./$build_dest)
echo "$cssReplace" > $build_dest
echo "index.html compiled into $build_dest"

13
docker-compose.yml Normal file
View File

@@ -0,0 +1,13 @@
services:
dev:
image: node:23-alpine3.20
volumes:
- ./:/App
- ./site:/App/build
stdin_open: true
tty: open
commnad: /bin/sh
httpd:
image: httpd:latest
volumes:
- ./site:/usr/local/apache2/htdocs/