feature: Update "Theme name:" in style.css

This commit is contained in:
Keith Solomon
2025-10-26 16:38:07 -05:00
parent 605b14f169
commit e100a2a709

View File

@@ -270,10 +270,28 @@ if (Test-Path "$ThemeDir\.git") { Remove-Item -Recurse -Force "$ThemeDir\.git" }
Invoke-WP "theme" "activate" "$Slug"
# --- Stamp Theme Name + Text Domain into style.css ---
$styleCss = Join-Path $ThemeDir "style.css"
$TextDomain = "$Slug" # matches your theme folder name
if (Test-Path $styleCss) {
$css = Get-Content $styleCss -Raw
# Replace existing "Theme Name:" line (supports plain or "* Theme Name:" formats)
$css = [regex]::Replace(
$css,
'(?im)^(?:\s*\*\s*)?Theme\s+Name\s*:\s*.*$',
" * Theme Name: $ProjectName"
)
Set-Content -Path $styleCss -Value $css -Encoding UTF8
Write-Host "Updated style.css header with Theme Name: $ProjectName"
}
Push-Location $ThemeDir
# ---- Init theme dependencies ----
# ---- Init theme dependencies and build Tailwind ----
composer install 2>$null
npm install 2>$null
npm run build 2>$null
# ---- Init new git repo ----
git init -b main | Out-Null
@@ -321,6 +339,7 @@ Project: $ProjectName
Slug: $Slug
Folder: $ProjectDir
Local URL: $LocalUrl
Local Admin URL: $LocalUrl/wp-admin/
DB Host: $MysqlHost
DB Port: $MysqlPort