Skip to content

Commit

Permalink
add markdown fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Cecilia Cisneros authored Sep 14, 2017
1 parent 4910740 commit ccaf674
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ npm install --save-dev webpack-bundle-tracker
pip install django-webpack-loader
```

<br>

## Configuration

<br>

### Assumptions

Assuming `BASE_DIR` in settings refers to the root of your django app.
Expand All @@ -51,7 +51,6 @@ STATICFILES_DIRS = (
)
```

<br>
Assuming your webpack config lives at `./webpack.config.js` and looks like this
```javascript
var path = require("path");
Expand All @@ -73,7 +72,6 @@ module.exports = {
```


<br>
### Default Configuration
```python
WEBPACK_LOADER = {
Expand All @@ -87,7 +85,6 @@ WEBPACK_LOADER = {
}
```

<br>

#### CACHE
```python
Expand All @@ -99,7 +96,6 @@ WEBPACK_LOADER = {
```
When `CACHE` is set to True, webpack-loader will read the stats file only once and cache the result. This means web workers need to be restarted in order to pick up any changes made to the stats files.

<br>

#### BUNDLE_DIR_NAME
```python
Expand All @@ -118,7 +114,6 @@ If the bundle generates a file called `main-cf4b5fab6e00a404e0c7.js` and your ST
<script type="text/javascript" src="/static/output/bundles/main-cf4b5fab6e00a404e0c7.js"/>
```
<br>
#### STATS_FILE
```python
Expand All @@ -137,24 +132,21 @@ new BundleTracker({filename: './webpack-stats.json'})
and your webpack config is located at `/home/src/webpack.config.js`, then the value of `STATS_FILE` should be `/home/src/webpack-stats.json`
<br>
#### IGNORE
`IGNORE` is a list of regular expressions. If a file generated by webpack matches one of the expressions, the file will not be included in the template.
<br>
#### POLL_INTERVAL
`POLL_INTERVAL` is the number of seconds webpack_loader should wait between polling the stats file. The stats file is polled every 200 miliseconds by default and any requests to are blocked while webpack compiles the bundles. You can reduce this if your bundles take shorter to compile.
**NOTE:** Stats file is not polled when in production (DEBUG=False).
<br>
## Usage
<br>
#### Manually run webpack to build assets.
Expand Down Expand Up @@ -198,8 +190,6 @@ INSTALLED_APPS = (
</head>
```
<br>
#### Multiple webpack projects
Expand Down Expand Up @@ -260,8 +250,6 @@ CKEDITOR.config.contentsCss = '{{ editor_css_files.0.publicPath }}';
```
<br>
## How to use in Production
**It is up to you**. There are a few ways to handle this. I like to have slightly separate configs for production and local. I tell git to ignore my local stats + bundle file but track the ones for production. Before pushing out newer version to production, I generate a new bundle using production config and commit the new stats file and bundle. I store the stats file and bundles in a directory that is added to the `STATICFILES_DIR`. This gives me integration with collectstatic for free. The generated bundles are automatically collected to the target directory and synched to S3.
Expand Down Expand Up @@ -291,8 +279,6 @@ if not DEBUG:
})
```
<br><br>
You can also simply generate the bundles on the server before running collectstatic if that works for you.
Expand Down Expand Up @@ -325,7 +311,6 @@ Then in your base jinja template:
```
--------------------
<br>
Enjoy your webpack with django :)

0 comments on commit ccaf674

Please sign in to comment.