Skip to content

Commit

Permalink
solve file size problem
Browse files Browse the repository at this point in the history
  • Loading branch information
leungwensen committed Jul 20, 2016
1 parent cee3b83 commit ff88984
Show file tree
Hide file tree
Showing 4 changed files with 2,292 additions and 4,622 deletions.
3 changes: 1 addition & 2 deletions bin/generate-demo-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ function reduceIcons(file, cb) { // removing prefix in filename
icons[type].icons = icons[type].icons || [];
icons[type].icons.push({
type,
name,
id: `si-${type}-${name}`
name
});
cb(null, file);
}
Expand Down
2 changes: 1 addition & 1 deletion demo/data/icons.json

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions demo/index.demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,34 @@ const $types = $('#types');
const $icons = $('#icons');
const $loading = $('#loading');

lang.each(iconTypes, (type) => {
const sprite = require(`raw!../dist/sprite/symbol/${type}.svg`);
$body.prepend(sprite);
});

const baseIconsClass = 'tab-content';

function renderIconsByType(type) {
const meta = icons[type];
if (!meta.rendered) {
$loading[0].setAttribute('style', 'display: block;');
setTimeout(() => {
const $type = $(`#${type}`);
lang.each(icons[type].icons, (icon) => {
$type.append(`<figure class="si-figure">
$.get(`../dist/sprite/symbol/${type}.svg`, (res) => {
$body.prepend(new XMLSerializer().serializeToString(res));
setTimeout(() => {
const $type = $(`#${type}`);
lang.each(icons[type].icons, (icon) => {
icon.id = `si-${icon.type}-${icon.name}`;
$type.append(`<figure class="si-figure">
<div id="figure-${icon.id}"></div>
<figcaption>${icon.type}-${icon.name}</figcaption>
</figure>`);
const iconType = `${icon.type}-${icon.name}`;
$(`#figure-${icon.id}`).append(
`<div class="si-wrapper ${icon.id}">
const iconType = `${icon.type}-${icon.name}`;
$(`#figure-${icon.id}`).append(
`<div class="si-wrapper ${icon.id}">
<svg class="si"><use xlink:href="#${icon.id}"></use></svg>
</div>`
);
});
meta.rendered = true;
$loading.hide();
}, 10);
);
});
meta.rendered = true;
$loading.hide();
}, 10);
});

}
}

Expand Down
Loading

0 comments on commit ff88984

Please sign in to comment.