Skip to content

Commit 33aa421

Browse files
Fonts handling
1 parent 6060ccd commit 33aa421

File tree

4 files changed

+13
-21
lines changed

4 files changed

+13
-21
lines changed

README.md

-18
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# React Webpack Starter
2-
> This is a boilerplate for React 16 & Webpack 4. It includes webpack-dev-server and a build script
3-
41
## Quick Start
52

63
``` bash
@@ -13,18 +10,3 @@ npm start
1310
# Build for production
1411
npm run build
1512
```
16-
17-
## App Info
18-
19-
### Author
20-
21-
Brad Traversy
22-
[Traversy Media](http://www.traversymedia.com)
23-
24-
### Version
25-
26-
1.0.0
27-
28-
### License
29-
30-
This project is licensed under the MIT License

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"babel-preset-env": "^1.6.1",
2323
"babel-preset-react": "^6.24.1",
2424
"css-loader": "^0.28.11",
25+
"file-loader": "^1.1.11",
2526
"html-webpack-plugin": "^3.1.0",
2627
"node-sass": "^4.9.2",
2728
"postcss-loader": "^2.1.6",

src/components/App.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import * as React from "react";
22

33
class App extends React.Component {
44

5-
clickHandler(): void {
6-
console.log('Invoke clickHandler');
5+
clickHandler(data: string): void {
6+
const msg: string = data;
77
}
88

99
render(): JSX.Element {
1010
return (
11-
<div onClick={() => this.clickHandler()}>
11+
<div onClick={() => this.clickHandler("Invoke clickHandler")}>
1212
<h1>My React App!</h1>
1313
</div>
1414
);

webpack.config.js

+9
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@ module.exports = {
3636
}
3737
}
3838
]
39+
},
40+
{
41+
test: /\.(ttf|eot|woff|woff2)$/,
42+
use: {
43+
loader: "file-loader",
44+
options: {
45+
name: "fonts/[name].[ext]",
46+
},
47+
},
3948
}
4049
]
4150
},

0 commit comments

Comments
 (0)