1
0
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:
Johan Fagerberg
2018-08-26 23:23:57 +02:00
committed by GitHub
parent 1aa1cf427c
commit 6ee6ba977c
5 changed files with 65 additions and 19 deletions

14
scripts/utils.js Normal file
View 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, "")
)
}