diff --git a/build/build-examples.js b/build/build-examples.js
new file mode 100644
index 000000000..f2d788438
--- /dev/null
+++ b/build/build-examples.js
@@ -0,0 +1,66 @@
+const fs = require('fs')
+const mkdirp = require('mkdirp')
+const path = require('path')
+const rimraf = require('rimraf')
+const walkSync = require('./walk-sync.js')
+
+const dataDir = path.join(__dirname, '../data')
+const examplesDir = path.join(__dirname, '../examples')
+
+const prefixes = {
+ brand: 'cib-',
+ duotone: 'cid-',
+ flag: 'cif-',
+ free: 'cil-',
+ linear: 'cil-',
+ solid: 'cis-'
+}
+
+const unique = (array, key) => array.map(e => e[key]).map((e, i, final) => final.indexOf(e) === i && i).filter(e => array[e]).map(e => array[e])
+
+const main = () => {
+ rimraf.sync(examplesDir)
+ mkdirp(examplesDir, (err) => {
+ if (err) {
+ return
+ }
+ const files = walkSync(dataDir).filter(element => path.extname(element) === '.json')
+ files.forEach(file => {
+ const rawdata = fs.readFileSync(file)
+ const icons = JSON.parse(rawdata).icons.sort((a,b) => (a.name > b.name) ? 1 : ((b.name > a.name) ? -1 : 0))
+
+ const type = path.basename(file).replace('.json', '')
+ const prefix = prefixes[type.toLowerCase()]
+
+ let html = `\n\n
\n \n`
+ html += ` CoreUI Icons - ${type}\n`
+ html += ` \n`
+ html += ` \n`
+ html += `\n\n`
+
+ html += ` \n`
+ unique(icons, 'name').forEach(icon => {
+ const name = icon.name
+ html += `
\n`
+ })
+ html += `
\n
\n`
+ html += ` \n`
+ unique(icons, 'name').forEach(icon => {
+ const name = icon.name
+ html += `
\n`
+ })
+ html += `
\n
\n`
+ html += ` \n`
+ unique(icons, 'name').forEach(icon => {
+ const name = icon.name
+ html += `
\n`
+ })
+ html += `
\n`
+ html += `\n`
+
+ fs.writeFileSync(path.join(examplesDir, path.basename(file).replace('.json', '.html')), html)
+ })
+ })
+}
+
+main()
diff --git a/build/build-fonts.js b/build/build-fonts.js
new file mode 100644
index 000000000..0fe54376b
--- /dev/null
+++ b/build/build-fonts.js
@@ -0,0 +1,88 @@
+const fs = require('fs')
+const mkdirp = require('mkdirp');
+const path = require('path')
+const webfont = require('webfont').default
+
+const argv = require('minimist')(process.argv.slice(2), {
+ string: ['src', 'name', 'prefix']
+})
+
+const dataDir = path.join(__dirname, '../data')
+const fontDir = path.join(__dirname, '../fonts')
+const svgDir = path.join(__dirname, '../svg', argv.src.toLowerCase())
+
+webfont({
+ files: `${svgDir}/**/*.svg`,
+ fontName: argv.name,
+ fontHeight: 5000,
+ startUnicode: 'ec0f',
+ verbose: true,
+}).then(result => {
+
+ mkdirp(fontDir, (err) => {
+ if (err) throw err
+
+ fs.writeFile(`${path.join(fontDir, argv.name)}.eot`, result.eot, (err) => {
+ if (err) throw err
+ console.log(`The ${path.join(fontDir, argv.name)}.eot file has been saved!`)
+ })
+
+ fs.writeFile(`${path.join(fontDir, argv.name)}.svg`, result.svg, (err) => {
+ if (err) throw err
+ console.log(`The ${path.join(fontDir, argv.name)}.eot file has been saved!`)
+ })
+
+ fs.writeFile(`${path.join(fontDir, argv.name)}.ttf`, result.ttf, (err) => {
+ if (err) throw err
+ console.log(`The ${path.join(fontDir, argv.name)}.eot file has been saved!`)
+ })
+
+ fs.writeFile(`${path.join(fontDir, argv.name)}.woff`, result.woff, (err) => {
+ if (err) throw err
+ console.log(`The ${path.join(fontDir, argv.name)}.eot file has been saved!`)
+ })
+
+ fs.writeFile(`${path.join(fontDir, argv.name)}.woff2`, result.woff2, (err) => {
+ if (err) throw err
+ console.log(`The ${path.join(fontDir, argv.name)}.eot file has been saved!`)
+ })
+ })
+
+
+ const iconsList = []
+
+ result.glyphsData.forEach(element => {
+ const name = element.metadata.name
+ const unicode = element.metadata.unicode
+
+ iconsList.push({
+ name: name.replace(`${argv.prefix}-`,''),
+ unicode: `\\${unicode[0].codePointAt(0).toString(16)}`
+ })
+ })
+
+ // Add unicodes to icons lists
+ fs.readFile(`${dataDir}/${argv.name.replace('CoreUI-Icons-', '')}.json`, 'utf8', function readFileCallback(err, data){
+ if (err) throw err
+ obj = JSON.parse(data)
+
+ const mergeByName = (a1, a2) =>
+ a1.map(itm => ({
+ ...a2.find((item) => (item.name === itm.name) && item),
+ ...itm
+ }))
+
+ json = JSON.stringify({
+ "icons": mergeByName(obj.icons, iconsList)
+ }, null, 2)
+
+ fs.writeFileSync(`${dataDir}/${argv.name.replace('CoreUI-Icons-', '')}.json`, json)
+ })
+})
+.catch(error => {
+ throw error
+})
+
+
+// formats: [ 'svg', 'ttf', 'eot', 'woff', 'woff2' ]
+// Bufer ttf, eot, woff
\ No newline at end of file
diff --git a/build/build-icons-lists.js b/build/build-icons-lists.js
new file mode 100644
index 000000000..05db1c715
--- /dev/null
+++ b/build/build-icons-lists.js
@@ -0,0 +1,76 @@
+const fs = require('fs')
+const mkdirp = require('mkdirp')
+const path = require('path')
+const walkSync = require('./walk-sync.js')
+
+const dataDir = path.join(__dirname, '../data')
+const rawDir = path.join(__dirname, '../raw')
+
+const prefixes = {
+ brand: 'cib-',
+ duotone: 'cid-',
+ flag: 'cif-',
+ free: 'cil-',
+ linear: 'cil-',
+ solid: 'cis-'
+}
+
+const main = () => {
+ const types = fs.readdirSync(rawDir).filter(element => fs.statSync(path.join(rawDir, element)).isDirectory())
+ const allIconsList = {
+ icons: []
+ }
+
+ types.forEach(type => {
+ const icons = walkSync(path.join(rawDir, type)).filter(element => path.extname(element) === '.svg').map(element => path.relative(path.join(rawDir, type), element).replace('SVG/', ''))
+ const iconsList = {
+ icons: []
+ }
+ icons.forEach(icon => {
+ const category = icon.split('/').length > 1 ? icon.split('/')[0] : type
+ const filename = icon.split('/').length > 1 ? icon.split('/')[1] : icon.split('/')[0]
+ const prefix = prefixes[type.toLowerCase()]
+
+ if (filename.indexOf(',') !== -1) {
+ throw `${type} - ${category} - ${filename}`
+ }
+
+ if (filename.indexOf('#') !== -1) {
+ filename.split('#').forEach(element => {
+ let iconDetails = {
+ name: element.replace('.svg', ''),
+ category,
+ type,
+ prefix
+ }
+ iconsList.icons.push(iconDetails)
+ allIconsList.icons.push(iconDetails)
+ })
+ } else {
+ let iconDetails = {
+ name: filename.replace('.svg', ''),
+ category,
+ type,
+ prefix
+ }
+ iconsList.icons.push(iconDetails)
+ allIconsList.icons.push(iconDetails)
+ }
+ })
+
+ let data = JSON.stringify(iconsList, null, 2)
+
+ mkdirp(dataDir, (err) => {
+ if (err) {
+ return
+ }
+
+ fs.writeFileSync(path.join(dataDir, `${type}.json`), data)
+ })
+ })
+
+ let data = JSON.stringify(allIconsList, null, 2)
+ fs.writeFileSync(path.join(dataDir, 'All.json'), data)
+}
+
+main()
\ No newline at end of file
diff --git a/build/build-js-files.js b/build/build-js-files.js
index 74d7bea50..825c41e50 100644
--- a/build/build-js-files.js
+++ b/build/build-js-files.js
@@ -1,7 +1,10 @@
const fs = require('fs')
-const mkdirp = require('mkdirp');
+const mkdirp = require('mkdirp')
+const path = require('path')
+const { extname } = path
+
const dirnames = process.mainModule.filename.includes('pro') ?
- ['solid', 'linear']
+ ['solid', 'linear', 'duotone', 'brand', 'flag']
: ['free', 'brand', 'flag']
let allNames = {}
@@ -18,96 +21,96 @@ dirnames.forEach(setName => {
let contents = {}
let names = []
filenames.forEach(filename => {
- fs.readFile(dirname + filename, 'utf-8', function (e, content) {
- if (e) {
- return
- }
-
- const variableName = toCamel(filename.replace('.svg', ''))
- const jsFilename = filename.replace('.svg', '.js')
- const tsFilename = filename.replace('.svg', '.d.ts')
- const viewBox = getAttributeValue(content, 'viewBox').split(' ')
- const dimensions = `${viewBox[2]} ${viewBox[3]}`
+ console.log(filename)
+ if (extname(filename) === '.svg') {
+ fs.readFile(dirname + filename, 'utf-8', function (e, content) {
+ if (e) {
+ return
+ }
+
+ const variableName = toCamel(filename.replace('.svg', ''))
+ const jsFilename = filename.replace('.svg', '.js')
+ const tsFilename = filename.replace('.svg', '.d.ts')
+ const viewBox = getAttributeValue(content, 'viewBox').split(' ')
+ const dimensions = `${viewBox[2]} ${viewBox[3]}`
- let iconData = []
- if (dimensions !== '64 64') {
- iconData.push(dimensions)
- }
- const computedContent = content.replace(/(