build.min
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
"./config.json" fread from-json :config
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
"Merging FA sprites..." notice!
"./src/icons/solid.svg" fread from-xml "symbol" xqueryall :solid-symbols
"./src/icons/brands.svg" fread from-xml "symbol" xqueryall :brands-symbols
solid-symbols brands-symbols concat :fa-symbols
{} :fa-icons
fa-symbols
(
:icon
icon 'svg %tag @icon
*icon/attributes/id :id
*icon/attributes :attributes
attributes "http://www.w3.org/2000/svg" %xmlns @attributes
attributes 'id ddel @attributes
icon attributes %attributes @icon
fa-icons icon id dset @fa-icons
)
foreach
fa-icons dkeys size :n-symbols
"Total icons: $#" (n-symbols) =% notice!
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(
symbol datauri
(dict:xml-element :icon ==> str :result)
(
icon to-xml :xml
; Encode
xml
"\"" "'" replace
"%" "%25" replace
"#" "%23" replace
"{" "%7B" replace
"}" "%7D" replace
"<" "%3C" replace
">" "%3E" replace
"\s+" " " replace
@xml
"data:image/svg+xml,$#" (xml) =% @result
)
) ::
(
symbol set-icon-fill
(dict:xml-element :icon str :fill ==> dict:xml-element :result)
(
icon /children first :path
*path/attributes :attributes
attributes fill %fill @attributes
path attributes %attributes @path
icon (path) => %children @result
)
) ::
(
symbol icon-content-rule
(str :id ==> str :result)
(
fa-icons id dget :icon
icon datauri :uri
".fa-$#:before { background-image: url(\"$#\") }" (id uri) =% @result
)
) ::
(
symbol icon-link-rule
(str :id ==> str :result)
(
fa-icons id dget :icon
*config/colors/link :fill
icon fill set-icon-fill @icon
*config/links id dget :matcher
icon datauri :uri
"a[href$#]:before { background-image: url(\"$#\") }" (matcher uri) =% @result
)
) ::
(
symbol icon-note-rule
(str :id ==> str :result)
(
fa-icons id dget :icon
*config/notes id dget :type
*config/colors type dget :fill
icon fill set-icon-fill @icon
icon datauri :uri
".$# > p:first-child:before { background-image: url(\"$#\") }" (type uri) =% @result
)
) ::
(
symbol icon-badge-rule
(str :id ==> str :result)
(
fa-icons id dget :icon
*config/badges id dget :badge
*badge/name :name
*badge/color :fill
icon fill set-icon-fill @icon
icon datauri :uri
".badge-$#:before { background-image: url(\"$#\") }" (name uri) =% @result
)
) ::
(
symbol generate-css
(str :css str :name ==>)
(
css "./dist/hastystyles.$#.css" (name) =% fwrite
"Generated: hastystyles.$#.css" (name) =% notice!
)
) ::
;;; hastystyles.icons.css
fa-icons dkeys 'icon-content-rule map "\n" join :icons-css
icons-css "icons" generate-css
;;; hastystyles.links.css
*config/links :links
links dkeys 'icon-link-rule map "\n" join :links-css
links-css "links" generate-css
;;; hastystyles.notes.css
*config/notes :notes
notes dkeys 'icon-note-rule map "\n" join :notes-css
notes-css "notes" generate-css
;;; hastystyles.badges.css
*config/badges :badges
badges dkeys 'icon-badge-rule map "\n" join :badges-css
badges-css "badges" generate-css
;;; hastystyles.css
!"lessc ./src/styles/hastystyles.less ./dist/hastystyles.css"
"Generated: hastystyles.css" notice!
;;; HastyStyles_TestDocument.htm
!"hastyscribe ./test/HastyStyles_TestDocument.md --noembed --output-file=./dist/HastyStyles_TestDocument.htm"
;;; Copy images
"./test/images/hastyscribe.png" "./dist/images/hastyscribe.png" cp
"./src/images/hastyscribe.svg" "./dist/hastyscribe.svg" cp
|