Skip to content

Commit

Permalink
Adds url-loader to the webpack configuration, allowing for Image and …
Browse files Browse the repository at this point in the history
…Font imports, along with an example import in the App component. Closes mui#15
  • Loading branch information
ctrlplusb committed Jul 24, 2016
1 parent 24acdac commit f8735e3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"react-hot-loader": "3.0.0-beta.2",
"rimraf": "2.5.4",
"style-loader": "0.13.1",
"url-loader": "0.5.7",
"webpack": "2.1.0-beta.19",
"webpack-dev-middleware": "1.6.1",
"webpack-hot-middleware": "2.12.1",
Expand Down
2 changes: 2 additions & 0 deletions src/shared/components/App/App.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'normalize.css/normalize.css';
import './globals.css';
import logo from './logo.png';

import React, { PropTypes } from 'react';
import Link from 'react-router/lib/Link';
Expand All @@ -8,6 +9,7 @@ function App({ children }) {
return (
<div style={{ padding: '10px' }}>
<div style={{ textAlign: 'center' }}>
<img src={logo} alt="Logo" style={{ width: '100px' }} />
<h1>React, Universally</h1>
<strong>
An ultra low dependency node v6 universal react boilerplate with
Expand Down
Binary file added src/shared/components/App/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions webpackConfigFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,17 @@ function webpackConfigFactory({ target, mode }, { json }) {
loader: 'json-loader',
},

// Images and Fonts
{
test: /\.(jpg|jpeg|png|gif|eot|svg|ttf|woff|woff2)$/,
loader: 'url-loader',
query: {
// Any file with a byte smaller than this will be "inlined" via
// a base64 representation.
limit: 10000,
},
},

// CSS
merge(
{ test: /\.css$/ },
Expand Down

0 comments on commit f8735e3

Please sign in to comment.