diff --git a/package.json b/package.json index 321f5dc..ea3efbb 100644 --- a/package.json +++ b/package.json @@ -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": "*", diff --git a/src/components/ui/icons.js b/src/components/ui/icons.js new file mode 100644 index 0000000..077c740 --- /dev/null +++ b/src/components/ui/icons.js @@ -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; + }, {}) + ; diff --git a/src/icons.font.json b/src/icons.font.json new file mode 100644 index 0000000..5f3c2ed --- /dev/null +++ b/src/icons.font.json @@ -0,0 +1,6 @@ +{ + "files": ["icons/webfont/*"], + "fontName": "ely-account-icons", + "fixedWidth": true, + "normalize": true +} diff --git a/src/components/icons/flag_belarus.svg b/src/icons/flag_belarus.svg similarity index 100% rename from src/components/icons/flag_belarus.svg rename to src/icons/flag_belarus.svg diff --git a/src/components/icons/flag_russian.svg b/src/icons/flag_russian.svg similarity index 100% rename from src/components/icons/flag_russian.svg rename to src/icons/flag_russian.svg diff --git a/src/components/icons/flag_ukraine.svg b/src/icons/flag_ukraine.svg similarity index 100% rename from src/components/icons/flag_ukraine.svg rename to src/icons/flag_ukraine.svg diff --git a/src/components/icons/flag_united_kingdom.svg b/src/icons/flag_united_kingdom.svg similarity index 100% rename from src/components/icons/flag_united_kingdom.svg rename to src/icons/flag_united_kingdom.svg diff --git a/src/components/icons/arrow.svg b/src/icons/webfont/arrow.svg similarity index 100% rename from src/components/icons/arrow.svg rename to src/icons/webfont/arrow.svg diff --git a/src/components/icons/caret.svg b/src/icons/webfont/caret.svg similarity index 100% rename from src/components/icons/caret.svg rename to src/icons/webfont/caret.svg diff --git a/src/components/icons/checkmark.svg b/src/icons/webfont/checkmark.svg similarity index 100% rename from src/components/icons/checkmark.svg rename to src/icons/webfont/checkmark.svg diff --git a/src/components/icons/close.svg b/src/icons/webfont/close.svg similarity index 100% rename from src/components/icons/close.svg rename to src/icons/webfont/close.svg diff --git a/src/components/icons/envelope.svg b/src/icons/webfont/envelope.svg similarity index 100% rename from src/components/icons/envelope.svg rename to src/icons/webfont/envelope.svg diff --git a/src/components/icons/key.svg b/src/icons/webfont/key.svg similarity index 100% rename from src/components/icons/key.svg rename to src/icons/webfont/key.svg diff --git a/src/components/icons/user.svg b/src/icons/webfont/user.svg similarity index 100% rename from src/components/icons/user.svg rename to src/icons/webfont/user.svg diff --git a/webpack.config.js b/webpack.config.js index 463f338..5de2781 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -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' } ] },