-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathfetch-css.ps1
20 lines (20 loc) · 912 Bytes
/
fetch-css.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# $importReg = "(await )?import\(['`"]\./(?<file>.*?)['`"]\)|import(?: )?['`"]\./(?<file>.*?)['`"];|import(?: )?\{.*\}(?: )?from(?: )?['`"]\./(?<file>.*?)['`"];|(?: )*\}(?: )?from(?: )?['`"]\./(?<file>.*?)['`"];"
$importReg = ".*?`"/static/latest/(?<prefix>.*?)\.(?<suffix>(\.module)?.+?)\.css`".*"
$filemy="./src/latest/index.659fabbf.js"
npx prettier -w ./tmp
Get-Content ./tmp/*.js | ForEach-Object {
if($_ -match $importReg) {
# Write-Output $_
$blip = Select-String $importReg -InputObject $_
# Write-Output -InputObject $blip.Matches
$matcha = $blip.Matches[0].Groups["prefix"]
$suff = $blip.Matches[0].Groups["suffix"]
$f = $fn.Value
Write-Output $matcha
((Get-Content $filemy -Raw) -replace "$matcha\..*?\.css`"","$matcha.$suff.css`"") | Set-Content $filemy
# curl -L "https://www.songsterr.com/static/latest/$f" > src/latest/$f
Write-Output "$f
"
}
}
# npx prettier -w ./src/latest