https://github.com/naivefeeling/flask-webpack-loader
Transparently use webpack with flask
https://github.com/naivefeeling/flask-webpack-loader
flask reactjs webpack
Last synced: 5 months ago
JSON representation
Transparently use webpack with flask
- Host: GitHub
- URL: https://github.com/naivefeeling/flask-webpack-loader
- Owner: naivefeeling
- License: mit
- Fork: true (django-webpack/django-webpack-loader)
- Created: 2019-05-11T02:49:53.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2021-10-13T15:46:12.000Z (over 4 years ago)
- Last Synced: 2025-10-28T17:10:30.596Z (8 months ago)
- Topics: flask, reactjs, webpack
- Language: Python
- Homepage:
- Size: 7.75 MB
- Stars: 4
- Watchers: 0
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# flask-webpack-loader
flask version [django-webpack-loader](https://github.com/owais/django-webpack-loader)
## Install
```bash
npm install --save-dev webpack-bundle-tracker
pip install flask-webpack-loader
```
## Usage
app.py
```python
from flask_webpack_loader import WebpackLoader
WEBPACK_LOADER = {
'BUNDLE_DIR_NAME': os.path.join('static', 'bundles'),
'STATIC_URL': 'static',
'STATS_FILE': 'webpack-stats.prod.json',
'POLL_INTERVAL': 0.1,
'TIMEOUT': None,
'IGNORES': [re.compile(r'.+\.hot-update.js'), re.compile(r'.+\.map')]
}
app.config['WEBPACK_LOADER'] = WEBPACK_LOADER
webpack_loader = WebpackLoader(app)
```
template.html
```html
{{ render_bundle('main') | safe }}
# webpack 4+
{{ render_bundle('runtime~main') | safe }}
{{ render_bundle('undefined') | safe }}
```