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

Update our Webpack documentation for Webpack 3 #24656

Merged
merged 3 commits into from Nov 3, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 17 additions & 3 deletions docs/4.0/getting-started/webpack.md
@@ -1,7 +1,7 @@
---
layout: docs
title: Webpack
description: Learn how to include Bootstrap in your project using Webpack 2.
description: Learn how to include Bootstrap in your project using Webpack 3.
group: getting-started
toc: true
---
Expand Down Expand Up @@ -29,6 +29,7 @@ import 'bootstrap/js/dist/dropdown';
Bootstrap is dependent on [jQuery](https://jquery.com/) and [Popper](https://popper.js.org/), so npm will install them for you if needed. But they must be explicitly provided by webpack. Add the following code to the `plugins` section in your webpack config file:

{% highlight js %}
// don't forget to import webpack (using import or require) to use webpack.ProvidePlugin
plugins: [
...
new webpack.ProvidePlugin({
Expand Down Expand Up @@ -83,7 +84,7 @@ For Bootstrap to compile, make sure you install and use the required loaders: [s
}
}
}, {
loader: 'sass-loader' // compiles SASS to CSS
loader: 'sass-loader' // compiles Sass to CSS
}]
},
...
Expand All @@ -97,4 +98,17 @@ Alternatively, you may use Bootstrap's ready-to-use css by simply adding this li
import 'bootstrap/dist/css/bootstrap.min.css';
{% endhighlight %}

In this case you may use your existing rule for `css` without any special modifications to webpack config.
In this case you may use your existing rule for `css` without any special modifications to webpack config except you don't need `sass-loader` just [style-loader](https://github.com/webpack-contrib/style-loader) and [css-loader](https://github.com/webpack-contrib/css-loader).

{% highlight js %}
...
module: {
rules: [
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
}
]
}
...
{% endhighlight %}