-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
41 lines (35 loc) · 1.01 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//
// main.c
//
//
// Created by Evan Anderson on 7/6/24.
//
#include <stdio.h>
#include "css/minifyCSS.c"
#include "js/minifyJS.c"
void test_minify(const char *file_path, const bool css) {
FILE *file = fopen(file_path, "r");
if (file) {
fseek(file, 0L, SEEK_END);
const long size = ftell(file);
fseek(file, 0L, SEEK_SET);
char string[size + 1];
fread(string, 1, size, file);
string[size] = '\0';
fclose(file);
char minified[size + 1];
if (css) {
minify_css(string, size, minified);
} else {
minify_js(string, size, minified);
}
printf("%s\n", minified);
} else {
printf("No file for path: %s\n", file_path);
}
}
int main(int argc, char *argv[]) {
test_minify("/Users/randomhashtags/GitProjects/swift-league-scheduling/Public/css/scheduler.css", true);
//test_minify("/Users/randomhashtags/GitProjects/swift-league-scheduling/Public/js/scheduler.js", false);
return 0;
}