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

Feature: Change extract_css default to true in all environments #2608

Merged
merged 3 commits into from
May 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 14 additions & 1 deletion docs/webpack-dev-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,20 @@ Now if you refresh your Rails view everything should work as expected.
## HOT module replacement

Webpacker out-of-the-box supports HMR with `webpack-dev-server` and
you can toggle it by setting `dev_server/hmr` option inside `webpacker.yml`.
you can toggle it by setting options in `config/webpacker.yml`:

```yaml
development:
# ...
extract_css: false
# ...
dev_server:
# ...
hmr: true
inline: true
# ...
```
`dev_server/hmr` option inside `webpacker.yml`.

Checkout this guide for more information:

Expand Down
8 changes: 4 additions & 4 deletions lib/install/config/webpacker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ default: &default
cache_manifest: false

# Extract and emit a css file
extract_css: false
extract_css: true

static_assets_extensions:
- .jpg
Expand Down Expand Up @@ -51,6 +51,9 @@ development:
<<: *default
compile: true

# Set to false if using HMR for CSS
extract_css: true

# Reference: https://webpack.js.org/configuration/dev-server/
dev_server:
https: false
Expand Down Expand Up @@ -85,8 +88,5 @@ production:
# Production depends on precompilation of packs prior to booting for performance.
compile: false

# Extract and emit a css file
extract_css: true

# Cache manifest.json for performance
cache_manifest: true
6 changes: 6 additions & 0 deletions lib/install/javascript/packs/application.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
Any CSS added to this file or imported from this file, e.g. `@import '../stylesheets/my-css.css'`,
will be included in the "application" pack. Any CSS imported from application.js or as part of the
application.js dependency graph, e.g. `import '../stylesheets/my-css.css'` will also be included
in the "application" pack.
*/