Skip to content

Commit a6af19a

Browse files
committed
- don't specify src by default in ldi font-face since it's usually in other path.
- add bundled `index.min.css` to simplify icon font loading - bump version
1 parent 2287f76 commit a6af19a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+87
-35
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Change Logs
22

3+
## v0.2.0
4+
5+
- don't specify `src` by default in ldi font-face since it's usually in other path.
6+
- add bundled `index.min.css` to simplify icon font loading
7+
8+
39
## v0.1.10
410

511
- republish to add missing files

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Build icon font with SVGs, along with a pixel-perfect line icon set in 24x24 / 1
77

88
## Usage
99

10-
include ldif.min.css file and specify font url ( if font file is not in the same directory of css file ):
10+
include ldif.min.css file and specify font url:
1111

1212
<link rel="stylesheet" type="text/css" href="ldif.min.css"/>
1313
<style type="text/css">

bin/bundle.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env node
2+
// Generated by LiveScript 1.6.0
3+
var fs, path, recurse;
4+
fs = require('fs');
5+
path = require('path');
6+
recurse = function(root){
7+
var cssFile, b64, css, files, i$, len$, file, results$ = [];
8+
cssFile = path.join(root, "ldif.min.css");
9+
if (fs.existsSync(cssFile)) {
10+
console.log("bundle " + cssFile + " ...");
11+
b64 = fs.readFileSync(path.join(root, "ldif.woff2")).toString('base64');
12+
css = fs.readFileSync(cssFile).toString();
13+
css += "@font-face{font-family:'ldi';src:url(data:font/woff2;base64," + b64 + ") format('woff2')}";
14+
fs.writeFileSync(path.join(root, "index.min.css"), css);
15+
}
16+
files = fs.readdirSync(root).map(function(it){
17+
return path.join(root, it);
18+
});
19+
for (i$ = 0, len$ = files.length; i$ < len$; ++i$) {
20+
file = files[i$];
21+
if (fs.statSync(file).isDirectory()) {
22+
results$.push(recurse(file));
23+
}
24+
}
25+
return results$;
26+
};
27+
recurse(path.join(__dirname, '..'));

build

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@
22
rm -rf dist
33
mkdir -p dist
44
mkdir -p bin
5-
rm -f bin/makefont.js bin/server.js
5+
rm -f bin/makefont.js bin/server.js bin/bundle.js
66
echo "build src/makefont.ls -> bin/makefont.js"
77
echo "#!/usr/bin/env node" > bin/makefont.js
88
./node_modules/.bin/lsc -cpb src/makefont.ls >> bin/makefont.js
99
chmod 755 bin/makefont.js
10+
echo "build src/bundle.ls -> bin/bundle.js"
11+
echo "#!/usr/bin/env node" > bin/bundle.js
12+
./node_modules/.bin/lsc -cpb src/bundle.ls >> bin/bundle.js
13+
chmod 755 bin/bundle.js
1014
echo "build src/server.ls -> bin/server.js"
1115
echo "#!/usr/bin/env node" > bin/server.js
1216
./node_modules/.bin/lsc -cpb src/server.ls >> bin/server.js
@@ -30,6 +34,9 @@ cat dist/legacy/ldif.ttf | ./node_modules/.bin/ttf2woff2 > dist/legacy/ldif.woff
3034
cat dist/line-16-light/ldif.ttf | ./node_modules/.bin/ttf2woff2 > dist/line-16-light/ldif.woff2
3135
cat dist/line-24-bold/ldif.ttf | ./node_modules/.bin/ttf2woff2 > dist/line-24-bold/ldif.woff2
3236

37+
echo "bundle font with css ..."
38+
./bin/bundle.js
39+
3340
echo "copy dist to dev web ..."
3441
rm -rf web/static/assets/lib/ldif/dev/
3542
mkdir -p web/static/assets/lib/ldif

dist/index.min.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/ldif.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
font-style: normal;
55
font-display: block;
66
/* this shold be overwritten by users to point to correct path */
7-
src: url("ldif.ttf") format('truetype');
87
}
98
i {
109
/* use !important to prevent issues with browser extensions that change fonts */

dist/ldif.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/ldif.ttf

0 Bytes
Binary file not shown.

dist/ldif.woff2

4 Bytes
Binary file not shown.

dist/legacy/index.min.css

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)