Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SVG webpack fix #473

Merged
merged 5 commits into from
Mar 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
"file-loader": "^4.2.0",
"mini-css-extract-plugin": "^0.9.0",
"node-sass": "^4.12.0",
"react-svg-loader": "^3.0.3",
"sass-loader": "^8.0.0",
"style-loader": "^1.0.0",
"webpack": "^4.41.2",
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
18 changes: 10 additions & 8 deletions src/components/about/HowItWorks.jsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import React from 'react';
import mobile from '@assets/mobile.svg';
import dataserver from '@assets/dataserver.svg';
import growth from '@assets/growth.svg';
import datavisualization from '@assets/datavisualization.svg';
// React-svg-loader for Webpack bundles SVGs and makes them available as
// React components which simply return the imported SVG paths.
import MobileSVG from '@assets/aboutmobile.svg';
import DataServerSVG from '@assets/aboutdataserver.svg';
import GrowthSVG from '@assets/aboutgrowth.svg';
import DataVizSVG from '@assets/aboutdatavis.svg';

const HowItWorks = () => (
<div className="how-it-works">
<h1>How It Works</h1>
<div className="grid-container">
<img src={mobile} alt="" />
<img src={dataserver} alt="" />
<img src={datavisualization} alt="" />
<img src={growth} alt="" />
<MobileSVG />
<DataServerSVG />
<GrowthSVG />
<DataVizSVG />
<p>Community members post reports via the City&apos;s easy-to-use mobile application.</p>
<p>
Reports are consolidated and entered into a central database and requests are
Expand Down
16 changes: 15 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,25 @@ module.exports = {
],
},
{
test: /\.(png|svg|jpg|gif)$/,
test: /\.(png|jpg|gif)$/,
use: [
'file-loader',
],
},
{
test: /\.svg$/,
use: [
{
loader: 'babel-loader',
},
{
loader: 'react-svg-loader',
options: {
jsx: true,
},
},
],
},
],
},
plugins: [
Expand Down