mirror of
https://github.com/laosb/SwiftTailwind.git
synced 2025-11-28 22:01:38 +00:00
Improve source file detection and tests
- Use SwiftPM-provided sourceFiles for filtering - Add Utils.swift with URL descendant check - Update example to use Views/ instead of Folder/ - Add test for non-included Swift file - Update .zed settings to disable VSCode CSS language server
This commit is contained in:
parent
cfb5d2a4a2
commit
8359d795eb
8 changed files with 68 additions and 9 deletions
24
Plugins/TailwindCSS/Utils.swift
Normal file
24
Plugins/TailwindCSS/Utils.swift
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
import Foundation
|
||||
|
||||
extension URL {
|
||||
func isOrIsDescendant(of ancestor: URL) -> Bool {
|
||||
guard ancestor.isFileURL, self.isFileURL else {
|
||||
return false
|
||||
}
|
||||
|
||||
let ancestorComponents = ancestor.pathComponents
|
||||
let selfComponents = self.pathComponents
|
||||
|
||||
guard selfComponents.count >= ancestorComponents.count else {
|
||||
return false
|
||||
}
|
||||
|
||||
for (index, component) in ancestorComponents.enumerated() {
|
||||
if selfComponents[index] != component {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue