22// cd webpack && webpack -w --config webpack.rails.config.js
33
44var path = require ( "path" ) ;
5+ var ExtractTextPlugin = require ( "extract-text-webpack-plugin" ) ;
56var railsBundleFile = "rails-bundle.js" ;
67var railsJsAssetsDir = "../app/assets/javascripts" ;
7- var railsBundleMapFile = railsBundleFile + ".map" ;
8- var railsBundleMapRelativePath = "../../../public/assets/" + railsBundleMapFile ;
8+ // var railsBundleMapFile = railsBundleFile + ".map";
9+ // var railsBundleMapRelativePath = "../../../public/assets/" + railsBundleMapFile;
910
1011module . exports = {
1112 context : __dirname ,
1213 entry : [
13- // to expose something Rails specific, uncomment the next line
14- //"./scripts/rails_only",
14+ //"./scripts/rails_only", // uncomment to expose Rails specific
1515 "./assets/javascripts/example" ,
1616
17- // Alternative for including everything with no customization
18- 'bootstrap-sass-loader'
19- //
20- // Example of using customization file
21- //'bootstrap-sass!./bootstrap-sass.config.js'
22- //
23- // Example of using customization file with ExtractTextPlugin
24- //"bootstrap-sass!./bootstrap-sass.extract-text-plugin.config.js"
17+ //'bootstrap-sass-loader' // include all bootstrap
18+ //'bootstrap-sass!./bootstrap-sass.config.js' // use custom bootstrap file
19+ 'bootstrap-sass!./bootstrap-sass.extract-text-plugin.config.js' // use custom bootstrap file w/ ExtractTextPlugin
2520 ] ,
2621 output : {
2722 filename : railsBundleFile ,
@@ -41,18 +36,27 @@ module.exports = {
4136 // bootstrap-sass-loader has access to the jQuery object
4237 { test : / b o o t s t r a p - s a s s \/ a s s e t s \/ j a v a s c r i p t s \/ / , loader : 'imports?jQuery=jquery' } ,
4338 { test : / \. s c s s $ / , loader : "style!css!sass?outputStyle=expanded&imagePath=/assets/images" } ,
44- { test : / \. w o f f $ / , loader : "url-loader?limit=10000&minetype=application/font-woff" } ,
45- { test : / \. t t f $ / , loader : "file-loader" } ,
46- { test : / \. e o t $ / , loader : "file-loader" } ,
47- { test : / \. s v g $ / , loader : "file-loader" } ,
39+ // Load Bootstrap's CSS
40+ // Needed for the css-loader when [bootstrap-sass-loader]
41+ { test : / \. w o f f ( \? v = \d + \. \d + \. \d + ) ? $ / , loader : "url?limit=10000&minetype=application/font-woff" } ,
42+ { test : / \. t t f ( \? v = \d + \. \d + \. \d + ) ? $ / , loader : "url?limit=10000&minetype=application/octet-stream" } ,
43+ { test : / \. e o t ( \? v = \d + \. \d + \. \d + ) ? $ / , loader : "file" } ,
44+ { test : / \. s v g ( \? v = \d + \. \d + \. \d + ) ? $ / , loader : "url?limit=10000&minetype=image/svg+xml" } ,
45+ //{ test: /\.woff$/, loader: "url-loader?limit=10000&minetype=application/font-woff" },
46+ //{ test: /\.ttf$/, loader: "file-loader" },
47+ //{ test: /\.eot$/, loader: "file-loader" },
48+ //{ test: /\.svg$/, loader: "file-loader" },
4849
4950 { test : / \. j s x $ / , loaders : [ 'es6' , 'jsx?harmony' ] } ,
5051 // Next 2 lines expose jQuery and $ to any JavaScript files loaded after rails-bundle.js
5152 // in the Rails Asset Pipeline. Thus, load this one prior.
5253 { test : require . resolve ( "jquery" ) , loader : "expose?jQuery" } ,
5354 { test : require . resolve ( "jquery" ) , loader : "expose?$" }
5455 ]
55- }
56+ } ,
57+ plugins : [
58+ new ExtractTextPlugin ( "../stylesheets/bootstrap-and-customizations.css" )
59+ ]
5660} ;
5761
5862var devBuild = ( typeof process . env [ "BUILDPACK_URL" ] ) === "undefined" ;
0 commit comments