mirror of
https://github.com/ionic-team/ionicons.git
synced 2026-12-05 17:33:41 +01:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
53235d66fe | ||
|
|
e30f3a0ec1 | ||
|
|
328d9634c6 | ||
|
|
fbdff5a85f |
File diff suppressed because it is too large
Load Diff
@@ -136,7 +136,7 @@
|
||||
padding: 20px 0;
|
||||
}
|
||||
</style>
|
||||
<link href="css/{{font_filename}}.css" rel="stylesheet" type="text/css" />
|
||||
<link href="css/ionicons.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
|
||||
<body class="characters-off">
|
||||
|
||||
+9
-16
@@ -13,7 +13,7 @@ SCSS_FOLDER_PATH = os.path.join(ROOT_PATH, 'scss')
|
||||
def main():
|
||||
generate_font_files()
|
||||
|
||||
data = get_manifest()
|
||||
data = get_build_data()
|
||||
|
||||
generate_scss(data)
|
||||
generate_cheatsheet(data)
|
||||
@@ -79,9 +79,9 @@ def generate_scss(data):
|
||||
def generate_css_from_scss(data):
|
||||
print "Generate CSS From SCSS"
|
||||
|
||||
scss_file_path = os.path.join(SCSS_FOLDER_PATH, '%s.scss' % (data['name'].lower()))
|
||||
css_file_path = os.path.join(CSS_FOLDER_PATH, '%s.css' % (data['name'].lower()))
|
||||
css_min_file_path = os.path.join(CSS_FOLDER_PATH, '%s.min.css' % (data['name'].lower()))
|
||||
scss_file_path = os.path.join(SCSS_FOLDER_PATH, 'ionicons.scss')
|
||||
css_file_path = os.path.join(CSS_FOLDER_PATH, 'ionicons.css')
|
||||
css_min_file_path = os.path.join(CSS_FOLDER_PATH, 'ionicons.min.css')
|
||||
|
||||
cmd = "sass %s %s" % (scss_file_path, css_file_path)
|
||||
call(cmd, shell=True)
|
||||
@@ -94,7 +94,6 @@ def generate_css_from_scss(data):
|
||||
def generate_cheatsheet(data):
|
||||
print "Generate Cheatsheet"
|
||||
|
||||
css_file_path = os.path.join(CSS_FOLDER_PATH, '%s.css' % (data['name'].lower()))
|
||||
cheatsheet_file_path = os.path.join(ROOT_PATH, 'cheatsheet.html')
|
||||
template_path = os.path.join(BUILDER_PATH, 'cheatsheet', 'template.html')
|
||||
icon_row_path = os.path.join(BUILDER_PATH, 'cheatsheet', 'icon-row.html')
|
||||
@@ -103,10 +102,6 @@ def generate_cheatsheet(data):
|
||||
template_html = f.read()
|
||||
f.close()
|
||||
|
||||
f = open(css_file_path, 'r')
|
||||
ionicons_css = f.read()
|
||||
f.close()
|
||||
|
||||
f = open(icon_row_path, 'r')
|
||||
icon_row_template = f.read()
|
||||
f.close()
|
||||
@@ -128,10 +123,8 @@ def generate_cheatsheet(data):
|
||||
content.append(item_row)
|
||||
|
||||
template_html = template_html.replace("{{font_name}}", data["name"])
|
||||
template_html = template_html.replace("{{font_filename}}", data["name"].lower())
|
||||
template_html = template_html.replace("{{font_version}}", data["version"])
|
||||
template_html = template_html.replace("{{icon_count}}", str(len(data["icons"])) )
|
||||
template_html = template_html.replace("{{ionicons_css}}", ionicons_css )
|
||||
template_html = template_html.replace("{{content}}", '\n'.join(content) )
|
||||
|
||||
f = open(cheatsheet_file_path, 'w')
|
||||
@@ -241,12 +234,12 @@ def generate_bower_json(data):
|
||||
f.close()
|
||||
|
||||
|
||||
def get_manifest():
|
||||
manifest_path = os.path.join(BUILDER_PATH, 'manifest.json')
|
||||
f = open(manifest_path, 'r')
|
||||
manifest_data = json.loads(f.read())
|
||||
def get_build_data():
|
||||
build_data_path = os.path.join(BUILDER_PATH, 'build_data.json')
|
||||
f = open(build_data_path, 'r')
|
||||
data = json.loads(f.read())
|
||||
f.close()
|
||||
return manifest_data
|
||||
return data
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"build_hash": "8667539bd6a4f4c7a7668eeb477a408a",
|
||||
"build_hash": "d99bb91023950fec2d6c01a6077fd7eb",
|
||||
"prefix": "ion-",
|
||||
"version": "1.3.0",
|
||||
"name": "Ionicons",
|
||||
|
||||
@@ -4,11 +4,13 @@ import md5
|
||||
import subprocess
|
||||
import tempfile
|
||||
import json
|
||||
import copy
|
||||
|
||||
SCRIPT_PATH = os.path.dirname(os.path.abspath(__file__))
|
||||
INPUT_SVG_DIR = os.path.join(SCRIPT_PATH, '..', '..', 'src')
|
||||
OUTPUT_FONT_DIR = os.path.join(SCRIPT_PATH, '..', '..', 'fonts')
|
||||
MANIFEST_PATH = os.path.join(SCRIPT_PATH, '..', 'manifest.json')
|
||||
BUILD_DATA_PATH = os.path.join(SCRIPT_PATH, '..', 'build_data.json')
|
||||
AUTO_WIDTH = False
|
||||
KERNING = 15
|
||||
|
||||
@@ -27,7 +29,13 @@ manifest_data = json.loads(manifest_file.read())
|
||||
manifest_file.close()
|
||||
print "Load Manifest, Icons: %s" % ( len(manifest_data['icons']) )
|
||||
|
||||
build_data = copy.deepcopy(manifest_data)
|
||||
build_data['icons'] = []
|
||||
|
||||
font_name = manifest_data['name']
|
||||
m.update(font_name + ';')
|
||||
m.update(manifest_data['version'] + ';')
|
||||
m.update(manifest_data['prefix'] + ';')
|
||||
|
||||
for dirname, dirnames, filenames in os.walk(INPUT_SVG_DIR):
|
||||
for filename in filenames:
|
||||
@@ -66,6 +74,10 @@ for dirname, dirnames, filenames in os.walk(INPUT_SVG_DIR):
|
||||
'code': chr_code
|
||||
})
|
||||
|
||||
build_data['icons'].append({
|
||||
'name': name,
|
||||
'code': chr_code
|
||||
})
|
||||
|
||||
if ext in ['.svg']:
|
||||
# hack removal of <switch> </switch> tags
|
||||
@@ -106,7 +118,7 @@ for dirname, dirnames, filenames in os.walk(INPUT_SVG_DIR):
|
||||
if AUTO_WIDTH:
|
||||
f.autoWidth(0, 0, 512)
|
||||
|
||||
fontfile = '%s/%s' % (OUTPUT_FONT_DIR, font_name.lower())
|
||||
fontfile = '%s/ionicons' % (OUTPUT_FONT_DIR)
|
||||
|
||||
build_hash = m.hexdigest()
|
||||
|
||||
@@ -147,9 +159,15 @@ else:
|
||||
subprocess.call('ttfautohint -s -f -n ' + fontfile + '.ttf ' + fontfile + '-hinted.ttf > /dev/null 2>&1 && mv ' + fontfile + '-hinted.ttf ' + fontfile + '.ttf', shell=True)
|
||||
|
||||
manifest_data['icons'] = sorted(manifest_data['icons'], key=lambda k: k['name'])
|
||||
build_data['icons'] = sorted(build_data['icons'], key=lambda k: k['name'])
|
||||
|
||||
print "Save Manifest, Icons: %s" % ( len(manifest_data['icons']) )
|
||||
manifest_file = open(MANIFEST_PATH, 'w')
|
||||
manifest_file.write( json.dumps(manifest_data, indent=2, separators=(',', ': ')) )
|
||||
manifest_file.close()
|
||||
f = open(MANIFEST_PATH, 'w')
|
||||
f.write( json.dumps(manifest_data, indent=2, separators=(',', ': ')) )
|
||||
f.close()
|
||||
|
||||
print "Save Build, Icons: %s" % ( len(build_data['icons']) )
|
||||
f = open(BUILD_DATA_PATH, 'w')
|
||||
f.write( json.dumps(build_data, indent=2, separators=(',', ': ')) )
|
||||
f.close()
|
||||
|
||||
|
||||
Binary file not shown.
+1
-1
@@ -5,7 +5,7 @@
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<metadata>
|
||||
Created by FontForge 20120731 at Tue Nov 5 19:31:34 2013
|
||||
Created by FontForge 20120731 at Tue Nov 5 22:52:50 2013
|
||||
By Adam Bradley
|
||||
Created by Adam Bradley with FontForge 2.0 (http://fontforge.sf.net)
|
||||
</metadata>
|
||||
|
||||
|
Before Width: | Height: | Size: 388 KiB After Width: | Height: | Size: 388 KiB |
Binary file not shown.
Binary file not shown.
@@ -34,6 +34,27 @@ You can use [ionicons.com](http://ionicons.com) to easily find the icon you want
|
||||
<i class="icon ion-home"></i>
|
||||
|
||||
|
||||
## Build Instructions
|
||||
|
||||
This repo already comes with all the files built and ready to go, but can also build the fonts from the source. Requires Python, FontForge and SASS:
|
||||
|
||||
1) Install FontForge, which is the program that creates the font files from the SVG files:
|
||||
|
||||
$ brew install fontforge ttfautohint
|
||||
|
||||
2) Install [SASS](http://sass-lang.com/)
|
||||
|
||||
$ gem install sass
|
||||
|
||||
3) Add or subtract files from the `svg/` folder you'd like to be apart of the font files.
|
||||
|
||||
4) Modify any settings in the `builder/manifest.json` file. You can change the name of the font-family and CSS classname prefix.
|
||||
|
||||
5) Run the build command:
|
||||
|
||||
python ./builder/generate.py
|
||||
|
||||
|
||||
## License
|
||||
|
||||
Ionicons is licensed under the [MIT license](http://opensource.org/licenses/MIT).
|
||||
|
||||
Reference in New Issue
Block a user