Skip to content

Commit 7939707

Browse files
committed
Include bootstrap in build
Otherwise, you cannot test without a web connection to get bootstrap.
1 parent 555ec0e commit 7939707

File tree

5 files changed

+236
-21
lines changed

5 files changed

+236
-21
lines changed

npm-shrinkwrap.json

Lines changed: 218 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
},
99
"dependencies": {
1010
"body-parser": "^1.8.2",
11+
"bootstrap-webpack": "*",
1112
"express": "^4.9.0",
1213
"jquery": "^2.1.1",
1314
"marked": "^0.3.2",
@@ -20,6 +21,8 @@
2021
"es6-loader": "^0.2.0",
2122
"expose-loader": "^0.5.3",
2223
"extract-text-webpack-plugin": "^0.3.1",
24+
"file-loader": "^0.7.2",
25+
"url-loader": "^0.5.5",
2326
"jsx-loader": "^0.11.0",
2427
"loader-utils": "^0.2.3",
2528
"react-hot-loader": "^0.4.3",

webpack/index.html

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,7 @@
22
<html>
33
<head>
44
<title>Hello React</title>
5-
<!-- Not present in the tutorial. Just for basic styling. -->
6-
<!--<link rel="stylesheet" href="../app/assets/stylesheets/base.css" />-->
7-
8-
<!-- Add twitter bootstrap -->
9-
<!-- Latest compiled and minified CSS -->
10-
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
11-
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
12-
13-
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
14-
<!--<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>-->
15-
<!--This contains the app's JS, including jQuery -->
165
<script src="express-bundle.js"></script>
17-
18-
<!-- Latest compiled and minified JavaScript -->
19-
<!--<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>-->
20-
216
</head>
227
<body>
238
<div id="content"></div>

webpack/scripts/webpack_only.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ require("test-stylesheet.css");
66
// Test out sass
77
require("test-sass-stylesheet.scss");
88

9+
require("expose?$!jquery");
10+
require("expose?jQuery!jquery");
11+
require("bootstrap-webpack");

webpack/webpack.hot.config.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,10 @@ module.exports = {
1818
plugins: [
1919
new webpack.HotModuleReplacementPlugin()
2020
],
21-
22-
// Let's load jQuery from the CDN
23-
externals: {
24-
jquery: "var jQuery"
25-
},
21+
// In case you wanted to load jQuery from the CDN, this is how you would do it:
22+
// externals: {
23+
// jquery: "var jQuery"
24+
// },
2625
resolve: {
2726
root: [ path.join(__dirname, "scripts"), path.join(__dirname, "assets/javascripts"),
2827
path.join(__dirname, "assets/stylesheets") ],
@@ -33,7 +32,14 @@ module.exports = {
3332
{ test: require.resolve("react"), loader: "expose?React" },
3433
{ test: /\.jsx$/, loaders: ["react-hot", "es6", "jsx?harmony"] },
3534
{ test: /\.css$/, loader: "style-loader!css-loader" },
36-
{ test: /\.scss$/, loader: "style!css!sass?outputStyle=expanded&imagePath=/assets/images"}
35+
{ test: /\.scss$/, loader: "style!css!sass?outputStyle=expanded&imagePath=/assets/images"},
36+
37+
// the url-loader uses DataUrls.
38+
// the file-loader emits files.
39+
{ test: /\.woff$/, loader: "url-loader?limit=10000&minetype=application/font-woff" },
40+
{ test: /\.ttf$/, loader: "file-loader" },
41+
{ test: /\.eot$/, loader: "file-loader" },
42+
{ test: /\.svg$/, loader: "file-loader" }
3743
]
3844
}
3945
};

0 commit comments

Comments
 (0)