Skip to content

Commit

Permalink
feat: Nesting and Regenerating ( Fixes #30 )
Browse files Browse the repository at this point in the history
  • Loading branch information
James Brundage committed Jan 6, 2024
1 parent 705a2ac commit 20c39ad
Show file tree
Hide file tree
Showing 1,238 changed files with 10 additions and 68,920 deletions.
17 changes: 10 additions & 7 deletions 4bitcss.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,22 @@ foreach ($jsonFile in $jsonFiles) {
$jsonObject = [IO.File]::ReadAllText($jsonFile.FullName) | ConvertFrom-Json
# and determine the name of the scheme and it's files.
$colorSchemeName = $jsonObject.Name
$colorSchemeFileName = $jsonObject.Name -replace '\s'
$colorSchemeFileName =
$jsonObject.Name -replace '\s','_' -replace '\p{P}','-' -replace '-+','-' -replace '-$'
# If the name wasn't there, continue.
if (-not $jsonObject.Name) { continue }
# If it wasn't legal, continue.
if ($jsonObject.Name -match '^\{') { continue }
$cssPath = (Join-Path $PSScriptRoot css)
# Export the theme to /css (so that repo-based CDNs have a logical link)
$jsonObject | Export-4BitCSS -OutputPath $cssPath -OutVariable colorSchemeCssFile

$ColorSchemePath = Join-Path $docsPath $colorSchemeFileName
if (-not (Test-Path $ColorSchemePath)) {
$null = New-Item -ItemType Directory -Path $ColorSchemePath
}
# Then export it again to /docs (so the GitHub page works)
$jsonObject | Export-4BitCSS -OutputPath $docsPath
$jsonObject | Export-4BitCSS -OutputPath $ColorSchemePath

$allColorSchemes += $colorSchemeName

Expand All @@ -63,11 +69,8 @@ foreach ($jsonFile in $jsonFiles) {
$darkColorSchemes += $colorSchemeName
}




# Create a preview file. All we need to change is the stylesheet.
$previewFilePath = Join-Path $docsPath "$colorSchemeFileName.md"
$previewFilePath = Join-Path $ColorSchemePath "$colorSchemeFileName.md"
@"
---
stylesheet: $colorSchemeFileName.css
Expand All @@ -83,7 +86,7 @@ $transpiledText
Get-Item -Path $previewFilePath

# Now create a preview SVG
$previewSvgPath = Join-Path $docsPath "$colorSchemeFileName.svg"
$previewSvgPath = Join-Path $ColorSchemePath "$colorSchemeFileName.svg"

# by expanding the string we have in $previewSVG (this will replace $ColorSchemeName)
$executionContext.SessionState.InvokeCommand.ExpandString($previewSvg) |
Expand Down
143 changes: 0 additions & 143 deletions docs/3024Day.css

This file was deleted.

53 changes: 0 additions & 53 deletions docs/3024Day.md

This file was deleted.

Binary file removed docs/3024Day.png
Binary file not shown.
27 changes: 0 additions & 27 deletions docs/3024Day.svg

This file was deleted.

Loading

0 comments on commit 20c39ad

Please sign in to comment.