Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate npm bootstrap-sass; Remove bootstrap-sass gem; Update README #3

Merged
merged 20 commits into from
Dec 13, 2014
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove ExtractTextPlugin
  • Loading branch information
mbreining committed Dec 1, 2014
commit 8b44d978d6cb02d30737d73d4e0cc5195e78e8c8
11 changes: 2 additions & 9 deletions webpack/bootstrap-sass.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,9 @@ module.exports = {
// Default for the style loading is to put in your js files
// styleLoader: "style-loader!css-loader!sass-loader";

// If you want to use the ExtractTextPlugin
// and you want compressed
// styleLoader: ExtractTextPlugin.extract("style-loader", "css-loader!sass-loader"),
// or if you want expanded CSS
// styleLoader: ExtractTextPlugin.extract("style-loader", "css-loader!sass?outputStyle=expanded"),

// ### Scripts
// Any scripts here set to false will never
// make it to the client, it's not packaged
// by webpack.
// Any scripts here set to false will never make it to the client,
// i.e. it's not packaged by webpack.
scripts: {
'transition': true,
'alert': true,
Expand Down
85 changes: 0 additions & 85 deletions webpack/bootstrap-sass.extract-text-plugin.config.js

This file was deleted.

4 changes: 2 additions & 2 deletions webpack/webpack.common.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ module.exports = {
// jquery: "var jQuery"
// },
resolve: {
root: [ path.join(__dirname, "scripts"), path.join(__dirname, "assets/javascripts"),
path.join(__dirname, "assets/stylesheets") ],
root: [path.join(__dirname, "scripts"), path.join(__dirname, "assets/javascripts"),
path.join(__dirname, "assets/stylesheets")],
extensions: ["", ".webpack.js", ".web.js", ".js", ".jsx", ".scss", ".css", "config.js"]
},
module: {
Expand Down
2 changes: 1 addition & 1 deletion webpack/webpack.hot.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var webpack = require("webpack");
config.entry.push("webpack-dev-server/client?http:https://localhost:3000",
"webpack/hot/dev-server",
"./scripts/webpack_only");
config.output = { filename: "express-bundle.js", // this file is never saved
config.output = { filename: "express-bundle.js", // this file is never saved on disk
path: __dirname };
config.plugins = [ new webpack.HotModuleReplacementPlugin() ];
module.exports = config;
21 changes: 2 additions & 19 deletions webpack/webpack.rails.config.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
// Run like this
// cd webpack && webpack -w --config webpack.rails.config.js
// cd webpack && $(npm bin)/webpack -w --config webpack.rails.config.js

var config = require("./webpack.common.config");
var path = require("path");
var ExtractTextPlugin = require("extract-text-webpack-plugin");

// Add the following entries as appropriate:
// "./scripts/rails_only" --> rails specific assets
// "bootstrap-sass-loader" --> all bootstrap assets
// "bootstrap-sass!./bootstrap-sass.config.js" --> custom bootstrap
// "bootstrap-sass!./bootstrap-sass.extract-text-plugin.config.js" --> custom bootstrap w/ separate css bundle (see https://github.com/webpack/extract-text-webpack-plugin)
config.entry.push("./assets/javascripts/example",
"bootstrap-sass!./bootstrap-sass.extract-text-plugin.config.js");
"bootstrap-sass!./bootstrap-sass.config.js");
config.output = { filename: "rails-bundle.js",
path: "../app/assets/javascripts" };
config.externals = { jquery: "var jQuery" }; // load jQuery from cdn or rails asset pipeline
Expand All @@ -20,32 +18,17 @@ config.module.loaders.push(
// bootstrap-sass-loader has access to the jQuery object
{ test: /bootstrap-sass\/assets\/javascripts\//, loader: "imports?jQuery=jquery" },
{ test: /\.scss$/, loader: "style!css!sass?outputStyle=expanded&imagePath=/assets/images"},
//{ test: /\.jsx$/, loaders: ['es6', 'jsx?harmony'] },
// Next 2 lines expose jQuery and $ to any JavaScript files loaded after rails-bundle.js
// in the Rails Asset Pipeline. Thus, load this one prior.
{ test: require.resolve("jquery"), loader: "expose?jQuery" },
{ test: require.resolve("jquery"), loader: "expose?$" }
);
// Load Bootstrap's CSS
// Needed for the css-loader when [bootstrap-sass-loader]
//{ test: /\.woff(\?v=\d+\.\d+\.\d+)?$/,
// loader: "url?limit=10000&minetype=application/font-woff" },
//{ test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
// loader: "url?limit=10000&minetype=application/octet-stream" },
//{ test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
// loader: "file" },
//{ test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
// loader: "url?limit=10000&minetype=image/svg+xml" },
config.plugins = [ new ExtractTextPlugin("../stylesheets/bootstrap-and-customizations.css") ];
module.exports = config;

var devBuild = (typeof process.env["BUILDPACK_URL"]) === "undefined";
if (devBuild) {
console.log("Webpack dev build for Rails");
//module.exports.devtool = "eval-source-map";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this commented? It's extremely important for the hot development mode or else you'll see a giant js file when debugging client side JS...

//module.exports.module.loaders.push(
// { test: require.resolve("react"), loader: "expose?React" }
//);
} else {
console.log("Webpack production build for Rails");
}