Skip to content

Commit 5058fed

Browse files
committed
Updated way of icons importing
1 parent a138666 commit 5058fed

File tree

6 files changed

+31
-58
lines changed

6 files changed

+31
-58
lines changed

meta.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ module.exports = {
5959
// Local icons
6060
'src/components/icons/**/*': 'need_localIcons',
6161
'src/assets/icons/**/*': 'need_localIcons',
62-
'utils/icon-list-generator/**/*': 'need_localIcons',
6362

6463
// Locales
6564
'src/locales/**/*': 'need_i18n',

package-lock.json

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

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,8 @@
2222
"bugs": {
2323
"url": "https://github.com/spacetab-io/vue-cli-web-app-template/issues"
2424
},
25-
"homepage": "https://github.com/spacetab-io/vue-cli-web-app-template#readme"
25+
"homepage": "https://github.com/spacetab-io/vue-cli-web-app-template#readme",
26+
"dependencies": {
27+
"@types/webpack-env": "^1.15.1"
28+
}
2629
}
Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
1-
/* Achtung: This file could be generated automatically! Run "npm run icons:update */
1+
import RequireContext = __WebpackModuleApi.RequireContext;
22

3-
/* eslint-disable */
4-
import '!@spacetabs/svg-sprite-loader?symbolId=app-icon-[name]!../../assets/icons/cross.svg';
3+
const iconsRequire = (ctx: RequireContext): string[] => {
4+
const keys = [...new Set(ctx.keys())];
5+
6+
return keys.map((item: string) => ctx(item).default);
7+
};
8+
9+
const icons = iconsRequire(require.context(
10+
'!@spacetabs/svg-sprite-loader?symbolId=app-icon-[name]!../../assets/icons/',
11+
true,
12+
/\.svg$/u,
13+
));
14+
15+
export default icons;

template/utils/icon-list-generator/_generator-helpers.js

Lines changed: 0 additions & 21 deletions
This file was deleted.

template/utils/icon-list-generator/script.js

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)