Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/icons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorMark Otto <markdotto@gmail.com>2020-05-20 00:33:49 +0300
committerMark Otto <otto@github.com>2020-05-20 00:44:45 +0300
commit4660b8afdf928e96d2904b21f19db008cd528856 (patch)
treeec018e129619e6b646b8059e48eefc575330376c /build
parent6af7c66ed177dfa8cefbae0fe69cc49182cd8035 (diff)
Slew of new calendar icons
- Two full variants, including fill versions of each - Renames original calendar icons to calendar3 - Adds one more calendar icon for good measure, but not a full suite for now
Diffstat (limited to 'build')
-rw-r--r--build/build-pages.js49
1 files changed, 49 insertions, 0 deletions
diff --git a/build/build-pages.js b/build/build-pages.js
new file mode 100644
index 000000000..e99782f60
--- /dev/null
+++ b/build/build-pages.js
@@ -0,0 +1,49 @@
+#!/usr/bin/env node
+
+'use strict'
+
+const fs = require('fs')
+const path = require('path')
+
+const iconsDir = path.join(__dirname, '../icons/')
+const pagesDir = path.join(__dirname, '../docs/content/icons/')
+
+function capitalizeFirstLetter(string) {
+ return string.charAt(0).toUpperCase() + string.slice(1)
+}
+
+(async () => {
+ try {
+ const files = await fs.promises.readdir(iconsDir)
+
+ for (const file of files) {
+ const iconBasename = path.basename(file, path.extname(file))
+ const iconTitleCap = capitalizeFirstLetter(iconBasename)
+ const iconTitle = iconTitleCap.split('-').join(' ')
+ const pageName = path.join(pagesDir, iconBasename + '.md')
+
+ const pageTemplate = `---
+title: ${iconTitle}
+layout: icon
+categories:
+tags:
+---\n`
+
+ fs.access(pageName, fs.F_OK, err => {
+ if (err) {
+ fs.writeFile(pageName, pageTemplate, err => {
+ if (err) {
+ throw err
+ }
+
+ console.log(`${iconBasename} successfully created`)
+ })
+ } else {
+ console.log(`${iconBasename} Permalink already exists`)
+ }
+ })
+ }
+ } catch (error) {
+ console.error('Error', error)
+ }
+})()