This repository was archived by the owner on Jun 1, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +24
-9
lines changed Expand file tree Collapse file tree 4 files changed +24
-9
lines changed Original file line number Diff line number Diff line change 5
5
" not dead"
6
6
],
7
7
"scripts" : {
8
- "watch" : " postcss -w ../Assets/**/*.css -o ../Resources/all.min.css --config ./postcss.config.js"
8
+ "watch" : " postcss -w ../Assets/**/*.css -o ../Sources/swift-doc/ Resources/all.min.css --config ./postcss.config.js"
9
9
},
10
10
"dependencies" : {
11
11
"cssnano" : " ^4.1.10" ,
Original file line number Diff line number Diff line change @@ -43,6 +43,9 @@ let package = Package(
43
43
. product( name: " SwiftSyntaxHighlighter " , package : " SwiftSyntaxHighlighter " ) ,
44
44
. product( name: " Logging " , package : " swift-log " ) ,
45
45
. product( name: " LoggingGitHubActions " , package : " LoggingGitHubActions " )
46
+ ] ,
47
+ resources: [
48
+ . copy( " Resources " )
46
49
]
47
50
) ,
48
51
. target(
File renamed without changes.
Original file line number Diff line number Diff line change @@ -120,9 +120,26 @@ extension SwiftDoc {
120
120
}
121
121
122
122
if case . html = format {
123
- let cssData = try fetchRemoteCSS ( )
124
- let cssURL = outputDirectoryURL. appendingPathComponent ( " all.css " )
125
- try writeFile ( cssData, to: cssURL)
123
+ let destinationURL = outputDirectoryURL. appendingPathComponent ( " all.css " )
124
+
125
+ func fetchRemoteCSS( ) throws -> Data {
126
+ let url = URL ( string: " https://raw.githubusercontent.com/SwiftDocOrg/swift-doc/master/Resources/all.min.css " ) !
127
+ return try Data ( contentsOf: url)
128
+ }
129
+
130
+ #if swift(>=5.3)
131
+ if let resourceURL = Bundle . module. url ( forResource: " all.min " , withExtension: " css " ) {
132
+ if !fileManager. fileExists ( atPath: destinationURL. path) {
133
+ try fileManager. copyItem ( at: resourceURL, to: destinationURL)
134
+ }
135
+ } else {
136
+ let cssData = try fetchRemoteCSS ( )
137
+ try writeFile ( cssData, to: destinationURL)
138
+ }
139
+ #else
140
+ let cssData = try fetchRemoteCSS ( )
141
+ try writeFile ( cssData, to: destinationURL)
142
+ #endif
126
143
}
127
144
128
145
} catch {
@@ -131,8 +148,3 @@ extension SwiftDoc {
131
148
}
132
149
}
133
150
}
134
-
135
- func fetchRemoteCSS( ) throws -> Data {
136
- let url = URL ( string: " https://raw.githubusercontent.com/SwiftDocOrg/swift-doc/master/Resources/all.min.css " ) !
137
- return try Data ( contentsOf: url)
138
- }
You can’t perform that action at this time.
0 commit comments