summaryrefslogtreecommitdiffstats
path: root/webpack.config.js
diff options
context:
space:
mode:
authorYoshie Muranaka <yoshiemuranaka@gmail.com>2019-06-05 12:30:30 -0500
committerYoshie Muranaka <yoshiemuranaka@gmail.com>2019-06-21 14:27:51 -0500
commitc86ce3c9c7736ef199d885596b6fc745c7d8c86e (patch)
treed8ce85478e7436298e328e91f0997d03747530b3 /webpack.config.js
parente4194ce0dc8a941c4f30fd0995f9ba4c13cec560 (diff)
downloadphosphor-webui-c86ce3c9c7736ef199d885596b6fc745c7d8c86e.tar.gz
phosphor-webui-c86ce3c9c7736ef199d885596b6fc745c7d8c86e.zip
Consolidate button styles
This patchset will create consistent button styling according to the styleguide and remove redundant button styles by creating reusable button classes. This patchset also implements a consistent strategy for including icon assets. Currently, svg icons are imported as CSS background images or inlined into the markup. Inlining an svg is preferred, especially when used with buttons or links so the colors can be easily changed for different states (hover, focus, disabled) without having to request variants. The icon provider allows us to inline svgs without cluttering the markup. Webpack config was adjusted to use svg-inline-loader when resolving svgs that are used by the icon provider directive. - All svgs were optimized to remove unncessary information. - Removed unused svg color variants - Moved icons used by icon provider to separate directory to avoid Webpack parsing the files twice - Small changes to navigation icons Signed-off-by: Yoshie Muranaka <yoshiemuranaka@gmail.com> Change-Id: I1ca214b74fc502e6b6e760cfee88b48110237c43
Diffstat (limited to 'webpack.config.js')
-rw-r--r--webpack.config.js19
1 files changed, 16 insertions, 3 deletions
diff --git a/webpack.config.js b/webpack.config.js
index 6c8667c..b1c8808 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -81,20 +81,33 @@ module.exports = (env, options) => {
// output
// Rename the file using the asset hash
// Pass along the updated reference to your code
- // You can add here any file extension you want to get copied to your
- // output
+ // You can add here any file extension you want to get copied
+ // to your output
+ // Excludes .svg files in icons directory
test: /\.(png|jpg|jpeg|gif|svg|woff|woff2|ttf|eot|ico)$/,
+ exclude: /icons\/.*\.svg$/,
loader: 'file-loader',
options: {name: '[path][name].[ext]'}
},
{
+ // INLINE SVG LOADER
+ // Inlines .svg assets in icons directory
+ // needed specifically for icon-provider.js directive
+ test: /icons\/.*\.svg$/,
+ loader: 'svg-inline-loader'
+ },
+ {
// HTML LOADER
// Reference: https://github.com/webpack/raw-loader
// Allow loading html through js
test: /\.html$/,
loader: 'html-loader'
},
- {test: /\.css$/, use: [MiniCssExtractPlugin.loader, 'css-loader']}, {
+ {
+ test: /\.css$/,
+ use: [MiniCssExtractPlugin.loader, 'css-loader'],
+ },
+ {
test: /\.scss$/,
use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader']
}
OpenPOWER on IntegriCloud