Skip to content

Commit 1492d6c

Browse files
authored
Feature/prepare 1.0.3 (#42)
1 parent 91c72ed commit 1492d6c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+5668
-11522
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Change Log
22

3+
## v1.0.3
4+
5+
1. Remove `Bootstrap` from the default setup.
6+
2. Update doc about `Bootstrap`, `SWC`, `React`, `Vue`
7+
6. Update frontend dependency to the latest version
8+
39
## v1.0.2
410

511
1. Support Node LTS Iron

README.md

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,11 @@
44
[![PyPI version](https://badge.fury.io/py/python-webpack-boilerplate.svg)](https://badge.fury.io/py/python-webpack-boilerplate)
55
[![Documentation](https://img.shields.io/badge/Documentation-link-green.svg)](https://python-webpack-boilerplate.rtfd.io/)
66

7-
## Difference between django-webpack-loader
8-
9-
When using `django-webpack-loader`, you need to create `Webpack` project on your own, which is not easy for many newbie Django developers.
10-
11-
`python-webpack-boilerplate` can let you play with modern frontend tech in Django, even you have no idea how to config Webpack.
12-
13-
## Features
14-
15-
- **Supports Django and Flask** (will support more framework in the future)
16-
- Automatic multiple entry points
17-
- Automatic code splitting
18-
- Hot Module Replacement (HMR) (auto reload web page if you edit JS or SCSS)
19-
- Easy to config and customize
20-
- ES6 Support via [babel](https://babeljs.io/) (v7)
21-
- JavaScript Linting via [eslint](https://eslint.org/)
22-
- SCSS Support via [sass-loader](https://github.com/jtangelder/sass-loader)
23-
- Autoprefixing of browserspecific CSS rules via [postcss](https://postcss.org/) and [postcss-preset-env](https://github.com/csstools/postcss-preset-env)
24-
- Style Linting via [stylelint](https://stylelint.io/)
25-
26-
----
27-
28-
If you want to import **lightweight modern frontend solution** to your web app, or you do not like **heavy framework** such as React, Vue.
29-
30-
Please check my book [The Definitive Guide to Hotwire and Django](https://leanpub.com/hotwire-django)
31-
32-
----
7+
Bring modern frontend tooling to Django, Flask, within minutes.
338

349
## Documentation
3510

36-
1. [Setup With Django](https://python-webpack-boilerplate.readthedocs.io/en/latest/setup_with_django/)
37-
2. [Setup With Flask](https://python-webpack-boilerplate.readthedocs.io/en/latest/setup_with_flask/)
38-
3. [Frontend Workflow](https://python-webpack-boilerplate.readthedocs.io/en/latest/frontend/)
11+
[Documentation](https://python-webpack-boilerplate.rtfd.io/)
3912

4013
## Raising funds
4114

docs/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../CHANGELOG.md

docs/deployment.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
On some platform such as Heroku, they have `buildpack` which can detect the project and deploy it automatically.
66

7-
1. Please use `run_npm_command_at_root` to make sure the `package.json` exists at the root directory. [Run NPM command at root directory](https://python-webpack-boilerplate.readthedocs.io/en/latest/run_npm_command_at_root/)
7+
1. Please use `run_npm_command_at_root` to make sure the `package.json` exists at the root directory. [Run NPM command at root directory](run_npm_command_at_root.md)
88
1. Enable the `Javascript buildpack` on Heroku, so Heroku will detect `package.json` and run `npm run build` during the deployment. [Using Multiple Buildpacks for an App](https://devcenter.heroku.com/articles/using-multiple-buildpacks-for-an-app)
99
1. If you want to specify the version of `node`, `npm`, please check [https://devcenter.heroku.com/articles/nodejs-support#supported-runtimes](https://devcenter.heroku.com/articles/nodejs-support#supported-runtimes)
1010

docs/frontend.md

Lines changed: 4 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -14,48 +14,23 @@
1414

1515
After creating frontend project from the template, you will have file structures like this.
1616

17-
``` hl_lines="4 8 10 12"
17+
```
1818
frontend
1919
├── package.json
2020
├── src
2121
│   ├── application
22-
│   │   # webpack entry files here
23-
│   │   ├── app.js
24-
│   │   └── app2.js
2522
│   ├── components
26-
│   │   └── sidebar.js
2723
│   └── styles
28-
│   └── index.scss
2924
├── vendors
3025
│   └── images
3126
│   ├── sample.jpg
3227
│   └── webpack.png
3328
```
3429

35-
1. We can add entry files to `application` . For example, `HomePage.js`, `BlogPage.js`
36-
1. Reusable components can be placed at `src/components`
30+
1. Components can be placed at `src/components`
3731
1. SCSS and CSS code can be put at `src/styles`
3832
1. Static assets such as images, fonts and other files can be put at `vendors`
3933

40-
## Config files
41-
42-
```
43-
├── .babelrc
44-
├── .browserslistrc
45-
├── .eslintrc
46-
├── .stylelintrc.json
47-
├── package.json
48-
├── postcss.config.js
49-
└── webpack
50-
├── webpack.common.js
51-
├── webpack.config.dev.js
52-
├── webpack.config.prod.js
53-
└── webpack.config.watch.js
54-
```
55-
56-
1. In the `frontend` directory, you can see above files, they are config files. (Some are dot files)
57-
1. `webpack` directory contains config files for webpack, you can customize it if you need.
58-
5934
## Compile
6035

6136
!!! note
@@ -73,36 +48,19 @@ $ npm run watch
7348

7449
You will see `build` directory is created under `frontend` directory
7550

76-
```
77-
build
78-
├── css
79-
│   └── app.css
80-
├── js
81-
│   ├── app.js
82-
│   ├── app2.js
83-
│   ├── runtime.js
84-
│   └── vendors-node_modules_bootstrap_dist_js_bootstrap_bundle_js.js
85-
├── manifest.json
86-
└── vendors
87-
└── images
88-
├── sample.jpg
89-
└── webpack.png
90-
```
91-
9251
1. `manifest.json` contains assets manifest info.
9352
1. We can get the dependency of the entrypoint through `manifest.json`
9453
1. So in templates, we can only import entrypoint without dependency files.
9554

96-
For example, `{{ javascript_pack('app', 'app2', attrs='charset="UTF-8"') }}` would generate HTMl like this
55+
For example, `{{ javascript_pack('app', attrs='charset="UTF-8"') }}` would generate HTMl like this
9756

9857
```html
9958
<script type="text/javascript" src="/static/js/runtime.js" charset="UTF-8"></script>
10059
<script type="text/javascript" src="/static/js/vendors-node_modules_bootstrap_dist_js_bootstrap_bundle_js.js" charset="UTF-8"></script>
10160
<script type="text/javascript" src="/static/js/app.js" charset="UTF-8"></script>
102-
<script type="text/javascript" src="/static/js/app2.js" charset="UTF-8"></script>
10361
```
10462

105-
1. `app` and `app2` are entrypoints
63+
1. `app` is entrypoint file
10664
1. `/static/js/runtime.js` and `/static/js/vendors-node_modules_bootstrap_dist_js_bootstrap_bundle_js.js` are all dependency files.
10765
1. `javascript_pack` helps us import bundle files transparently
10866

docs/images/react-example.jpg

257 KB
Loading

docs/images/react-example.png

-504 KB
Binary file not shown.

docs/images/readme-head.svg

Lines changed: 14 additions & 13 deletions
Loading

docs/images/vue-example.jpg

319 KB
Loading

docs/images/vue-example.png

-512 KB
Binary file not shown.

0 commit comments

Comments
 (0)