1
0
mirror of https://github.com/axzilla/templui.git synced 2025-02-21 00:53:18 +00:00

change: pkg WIP

This commit is contained in:
“axzilla” 2024-10-09 15:44:37 +02:00
parent 6c253c801d
commit ec5ea46d1b
5 changed files with 2180 additions and 8 deletions

View File

@ -1,10 +1,7 @@
# Run templ generation in watch mode to detect all .templ files and
# re-create _templ.txt files on change, then send reload event to browser.
# Default url: http://localhost:7331
# Dev Tools
templ:
templ generate --watch --proxy="http://localhost:8090" --open-browser=false -v
# Run air to detect any go file changes to re-build and re-run the server.
server:
air \
--build.cmd "go build -o tmp/bin/main ./cmd/server" \
@ -15,21 +12,24 @@ server:
--build.stop_on_error "false" \
--misc.clean_on_exit true
# Run tailwindcss to generate the styles.css bundle in watch mode.
tailwind:
npx tailwindcss -i ./assets/css/input.css -o ./assets/css/output.css --watch
# Start development server
dev:
make -j3 templ server tailwind
# Start development server in debug mode - It's needed to start launch.json in VSCode
debug:
make -j2 templ tailwind
# Generate Lucid icons
# Package Tools
generate-icons:
go run cmd/icongen/main.go
generate-lib:
templ generate ./pkg/...
generate-css:
npx tailwindcss -i ./assets/css/input.css -o ./pkg/styles/goilerplate.css
update-package: generate-css generate-lib # generate-icons <- if needed
@echo "Package updated successfully"

2149
pkg/styles/goilerplate.css Normal file

File diff suppressed because it is too large Load Diff

23
pkg/styles/styles.go Normal file
View File

@ -0,0 +1,23 @@
package helpers
import (
"github.com/a-h/templ"
"github.com/axzilla/goilerplate/internals/config"
)
// CSS returns a link tag for the Goilerplate CSS
func CSS() templ.Component {
if config.AppConfig.GoEnv == "production" {
return templ.Raw(`<link rel="stylesheet" href="https://github.com/axzilla/goilerplate/blob/main/pkg/styles/goilerplate.css">`)
}
return templ.Raw(`<link rel="stylesheet" href="https://github.com/axzilla/goilerplate/blob/dev/pkg/styles/goilerplate.css">`)
}
// Alpine returns script tags for Alpine.js
func Alpine() templ.Component {
return templ.Raw(`
<script defer src="https://cdn.jsdelivr.net/npm/@alpinejs/focus@3.x.x/dist/cdn.min.js"></script>
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
`)
}