Skip to content

Commit 519924f

Browse files
committed
Compress common css
1 parent 79a174b commit 519924f

File tree

4 files changed

+9
-11
lines changed

4 files changed

+9
-11
lines changed

scripts/generateArticlesIndex.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const exclude = ["article.d.ts", "index.ts", "tags.ts"];
55
const articlesDir = path.resolve(__dirname, "../src/assets/state/articles");
66
const indexPath = path.join(articlesDir, "/index.ts");
77

8-
const run = async () => {
8+
const runScript = async () => {
99
const files = await fs.readdir(articlesDir);
1010
let fileImports = `import IArticle from "./article";\n\n`;
1111
let exportArrayContent = "export default [\n";
@@ -29,4 +29,4 @@ const run = async () => {
2929
await fs.writeFile(indexPath, indexContent);
3030
};
3131

32-
run();
32+
runScript();

scripts/generateCName.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ const dotenv = require("dotenv");
55
dotenv.config({ path: path.resolve(__dirname, "../.env") });
66
dotenv.config({ path: path.resolve(__dirname, "../.env.local"), override: true });
77

8-
const run = async () => {
8+
const runScript = async () => {
99
const outDir = path.resolve(__dirname, "../out");
1010
const url = new URL(process.env.NEXT_PUBLIC_FRONTEND_URL)
1111
fs.writeFile(path.join(outDir, "CNAME"), url.host);
1212
};
1313

14-
run();
14+
runScript();

scripts/generateRobots.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const dotenv = require("dotenv");
55
dotenv.config({ path: path.resolve(__dirname, "../.env") });
66
dotenv.config({ path: path.resolve(__dirname, "../.env.local"), override: true });
77

8-
const run = async () => {
8+
const runScript = async () => {
99
const outDir = path.resolve(__dirname, "../out");
1010

1111
let content = "";
@@ -17,4 +17,4 @@ const run = async () => {
1717
fs.writeFile(path.join(outDir, "robots.txt"), content);
1818
};
1919

20-
run();
20+
runScript();

scripts/generateSitemap.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const { glob } = require("glob");
88
dotenv.config({ path: path.resolve(__dirname, "../.env") });
99
dotenv.config({ path: path.resolve(__dirname, "../.env.local"), override: true });
1010

11-
const run = async () => {
11+
const runScript = async () => {
1212
const outDir = path.resolve(__dirname, "../out");
1313
const pages = await glob("**/*.html", {
1414
cwd: outDir
@@ -17,9 +17,7 @@ const run = async () => {
1717
let sitemapContent = `<?xml version="1.0" encoding="UTF-8"?>\n<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">\n`;
1818
const sitemapUrls = await Promise.all(pages.map(async (pagePath) => {
1919
let canonicalUrl = `${process.env.NEXT_PUBLIC_FRONTEND_URL}/${pagePath.replace(/\\/g, "/")}`
20-
.replace(/((index)*(\.html))$/g, "");
21-
22-
if (!canonicalUrl.endsWith("/")) canonicalUrl += "/";
20+
.replace(/(\/?(index)?(\.html))$/g, "");
2321

2422
const fileContent = await fs.readFile(path.resolve(outDir, pagePath));
2523

@@ -48,4 +46,4 @@ const run = async () => {
4846
fs.writeFile(path.join(outDir, "sitemap.xml"), sitemapContent);
4947
};
5048

51-
run();
49+
runScript();

0 commit comments

Comments
 (0)