Skip to content

Commit f258ba0

Browse files
committed
Fix bootstrap-sass config to properly load images (#7); Add webpack png file as example and test
1 parent 6446487 commit f258ba0

File tree

8 files changed

+19
-5
lines changed

8 files changed

+19
-5
lines changed

app/assets/images/webpack.png

12.5 KB
Loading

webpack/_main.scss

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
// This file is used as part of the bootstrap-sass-loader customization
2-
// Compare this to main.scss (no underscore) which is loaded by itself
32
// ## Baseline
43

5-
// Included from bootstrap.config.less.
4+
// Included from bootstrap-sass.config.js
65
body {
76
padding-top: 20px;
87
}
@@ -15,6 +14,13 @@ body {
1514
padding-top: 10px;
1615
}
1716

17+
.webpack-image {
18+
background-image: image-url("webpack.png");
19+
background-repeat: no-repeat;
20+
background-position: right bottom;
21+
height: 120px;
22+
}
23+
1824
// ## Nav
1925
// When nav is affixed, set it's position and size.
2026
#nav.affix {
@@ -63,4 +69,3 @@ table.file-table {
6369
margin: 0 0 !important;
6470
}
6571
}
66-

webpack/assets/javascripts/example.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ var render = () => {
1111
<div>
1212
<CommentBox url="comments.json" pollInterval={2000} />
1313
<div className="twitter-image container"/>
14+
<div className="webpack-image container"/>
1415
</div>,
1516
document.getElementById('content')
1617
);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// These variables get loaded BEFORE Bootstrap thus overriding them in Bootstrap.
12
$body-bg: #EFF8FB; // background w/ character
23
$navbar-default-bg: #FFFFE0; // fancy yellow navbar
34
$font-size-base: 15px; // make it bigger!

webpack/bootstrap-sass.config.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ module.exports = {
66
mainSass: "./_main.scss",
77

88
// Default for the style loading is to put in your js files
9-
// styleLoader: "style-loader!css-loader!sass-loader";
9+
// styleLoader: "style-loader!css-loader!sass-loader",
10+
11+
// See: https://github.com/sass/node-sass#outputstyle
12+
// https://github.com/sass/node-sass#imagepath
13+
styleLoader: "style-loader!css-loader!sass-loader?imagePath=/assets/images",
1014

1115
// ### Scripts
1216
// Any scripts here set to false will never make it to the client,

webpack/server.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ var server = new WebpackDevServer(webpack(config), {
1111
//contentBase: "/public",
1212
publicPath: config.output.publicPath,
1313
hot: true,
14+
noInfo: false,
1415
stats: {colors: true}
1516
});
1617

webpack/webpack.common.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Common webpack configuration used by webpack.hot.config and webpack.bundle.config.
1+
// Common webpack configuration used by webpack.hot.config and webpack.rails.config.
22

33
var path = require("path");
44

webpack/webpack.hot.config.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
var config = require("./webpack.common.config");
55
var webpack = require("webpack");
66

7+
// We're using the bootstrap-sass loader.
8+
// See: https://github.com/justin808/bootstrap-sass-loader
79
config.entry.push("webpack-dev-server/client?http://localhost:3000",
810
"webpack/hot/dev-server",
911
"./scripts/webpack_only",

0 commit comments

Comments
 (0)