11// Run like this
2- // cd webpack && webpack -w --config webpack.rails.config.js
2+ // cd webpack && $(npm bin)/ webpack -w --config webpack.rails.config.js
33
44var config = require ( "./webpack.common.config" ) ;
55var path = require ( "path" ) ;
6- var ExtractTextPlugin = require ( "extract-text-webpack-plugin" ) ;
76
87// Add the following entries as appropriate:
98// "./scripts/rails_only" --> rails specific assets
109// "bootstrap-sass-loader" --> all bootstrap assets
1110// "bootstrap-sass!./bootstrap-sass.config.js" --> custom bootstrap
12- // "bootstrap-sass!./bootstrap-sass.extract-text-plugin.config.js" --> custom bootstrap w/ separate css bundle (see https://github.com/webpack/extract-text-webpack-plugin)
1311config . entry . push ( "./assets/javascripts/example" ,
14- "bootstrap-sass!./bootstrap-sass.extract-text-plugin. config.js" ) ;
12+ "bootstrap-sass!./bootstrap-sass.config.js" ) ;
1513config . output = { filename : "rails-bundle.js" ,
1614 path : "../app/assets/javascripts" } ;
1715config . externals = { jquery : "var jQuery" } ; // load jQuery from cdn or rails asset pipeline
@@ -20,32 +18,17 @@ config.module.loaders.push(
2018 // bootstrap-sass-loader has access to the jQuery object
2119 { 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" } ,
2220 { test : / \. s c s s $ / , loader : "style!css!sass?outputStyle=expanded&imagePath=/assets/images" } ,
23- //{ test: /\.jsx$/, loaders: ['es6', 'jsx?harmony'] },
2421 // Next 2 lines expose jQuery and $ to any JavaScript files loaded after rails-bundle.js
2522 // in the Rails Asset Pipeline. Thus, load this one prior.
2623 { test : require . resolve ( "jquery" ) , loader : "expose?jQuery" } ,
2724 { test : require . resolve ( "jquery" ) , loader : "expose?$" }
2825) ;
29- // Load Bootstrap's CSS
30- // Needed for the css-loader when [bootstrap-sass-loader]
31- //{ test: /\.woff(\?v=\d+\.\d+\.\d+)?$/,
32- // loader: "url?limit=10000&minetype=application/font-woff" },
33- //{ test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
34- // loader: "url?limit=10000&minetype=application/octet-stream" },
35- //{ test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
36- // loader: "file" },
37- //{ test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
38- // loader: "url?limit=10000&minetype=image/svg+xml" },
39- config . plugins = [ new ExtractTextPlugin ( "../stylesheets/bootstrap-and-customizations.css" ) ] ;
4026module . exports = config ;
4127
4228var devBuild = ( typeof process . env [ "BUILDPACK_URL" ] ) === "undefined" ;
4329if ( devBuild ) {
4430 console . log ( "Webpack dev build for Rails" ) ;
4531 //module.exports.devtool = "eval-source-map";
46- //module.exports.module.loaders.push(
47- // { test: require.resolve("react"), loader: "expose?React" }
48- //);
4932} else {
5033 console . log ( "Webpack production build for Rails" ) ;
5134}
0 commit comments