Первая версия ссупорта генерации шрифтов из иконок

This commit is contained in:
SleepWalker 2016-01-05 23:06:19 +02:00
parent c244a7b16b
commit f48533b70f
15 changed files with 23 additions and 9 deletions

View File

@ -44,6 +44,7 @@
"eslint": "^1.10.3",
"eslint-plugin-react": "^3.13.1",
"extract-text-webpack-plugin": "^0.9.1",
"fontgen-loader": "^0.1.9",
"html-webpack-plugin": "^1.7.0",
"imports-loader": "^0.6.4",
"karma": "*",

View File

@ -0,0 +1,12 @@
import icons from 'icons.font.json';
const baseClass = 'icon';
export default Object.keys(icons)
.filter((icon) => icon !== baseClass)
.reduce((acc, icon) => {
acc[icon.replace(`${baseClass}-`, '')] = `${icons[baseClass]} ${icons[icon]}`;
return acc;
}, {})
;

6
src/icons.font.json Normal file
View File

@ -0,0 +1,6 @@
{
"files": ["icons/webfont/*"],
"fontName": "ely-account-icons",
"fixedWidth": true,
"normalize": true
}

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 265 B

After

Width:  |  Height:  |  Size: 265 B

View File

Before

Width:  |  Height:  |  Size: 179 B

After

Width:  |  Height:  |  Size: 179 B

View File

Before

Width:  |  Height:  |  Size: 522 B

After

Width:  |  Height:  |  Size: 522 B

View File

Before

Width:  |  Height:  |  Size: 574 B

After

Width:  |  Height:  |  Size: 574 B

View File

Before

Width:  |  Height:  |  Size: 425 B

After

Width:  |  Height:  |  Size: 425 B

View File

Before

Width:  |  Height:  |  Size: 386 B

After

Width:  |  Height:  |  Size: 386 B

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 422 B

After

Width:  |  Height:  |  Size: 422 B

View File

Before

Width:  |  Height:  |  Size: 628 B

After

Width:  |  Height:  |  Size: 628 B

View File

Before

Width:  |  Height:  |  Size: 709 B

After

Width:  |  Height:  |  Size: 709 B

View File

@ -21,7 +21,7 @@ var isTest = process.argv.some(function(arg) {
return arg.indexOf('karma') !== -1;
});
const CSS_LOADER = 'style!css?modules&importLoaders=1&localIdentName=[path][name]-[local]!postcss';
const CSS_LOADER = 'style!css?modules&importLoaders=2&localIdentName=[path][name]-[local]!postcss';
var webpackConfig = {
entry: {
@ -107,15 +107,10 @@ var webpackConfig = {
plugins: ['transform-runtime', ['react-intl', {messagesDir: './dist/messages/'}]]
}
},
{ // DEPRECATED
test: /i18n\/.*\.less$/,
loader: CSS_LOADER + '!less'
},
{ // DEPRECATED
test: /\.less$/,
{
test: /\.font.(js|json)$/,
extractInProduction: true,
exclude: /i18n\/.*\.less$/,
loader: CSS_LOADER + '!less'
loader: CSS_LOADER + '!fontgen?types=woff,eot,ttf'
}
]
},