You've already forked simple-icons
mirror of
https://github.com/simple-icons/simple-icons.git
synced 2025-07-12 22:21:23 +02:00
Add prepublish script (#942)
* Add prepublish script Compiles icons into both static js files (icons/{filename}.js) and into a static index.js. The latter is not tree-shakeable. Closes #941, closes #751 * Add information on tree-shaking to README * Remove index.js after publishing * Change 'prepublish' to 'prepublishOnly' * Link to webpack in README * Simplify postpublish cleanup Thanks @ericcornelissen * Fix quote usage in prepublish.js * Fix quote usage in utils.js * Optimized file size of prepublish output * Improved readability of prepublish script
This commit is contained in:
14
scripts/utils.js
Normal file
14
scripts/utils.js
Normal file
@ -0,0 +1,14 @@
|
||||
module.exports = {
|
||||
/**
|
||||
* Converts a brand title into a filename (not a full path)
|
||||
* @param {String} title The title to convert
|
||||
*/
|
||||
titleToFilename: title => (
|
||||
title.toLowerCase()
|
||||
.replace(/\+/g, "plus")
|
||||
.replace(/^\./, "dot-")
|
||||
.replace(/\.$/, "-dot")
|
||||
.replace(/\./g, "-dot-")
|
||||
.replace(/[ !’]/g, "")
|
||||
)
|
||||
}
|
Reference in New Issue
Block a user