1 | # Django Apps Webpack Alias
|
2 | [![Open Source Love](https://badges.frapsoft.com/os/v1/open-source.svg?v=103)](https://github.com/ellerbrock/open-source-badges/)
|
3 | [![license](https://img.shields.io/github/license/marinko-peso/django-apps-webpack-alias.svg)](https://github.com/marinko-peso/django-apps-webpack-alias/blob/master/LICENSE)
|
4 | [![js-semistandard-style](https://img.shields.io/badge/code%20style-semistandard-brightgreen.svg)](https://github.com/Flet/semistandard)
|
5 | [![package version](https://img.shields.io/npm/v/django-apps-webpack-alias.svg)](https://npm.im/django-apps-webpack-alias)
|
6 | [![install size](https://packagephobia.now.sh/badge?p=django-apps-webpack-alias)](https://packagephobia.now.sh/result?p=django-apps-webpack-alias)
|
7 | [![dependecies](https://david-dm.org/marinko-peso/django-apps-webpack-alias.svg)](https://david-dm.org/marinko-peso/django-apps-webpack-alias)
|
8 | [![codecov](https://codecov.io/gh/marinko-peso/django-apps-webpack-alias/branch/master/graph/badge.svg)](https://codecov.io/gh/marinko-peso/django-apps-webpack-alias)
|
9 |
|
10 | Automatically discovery django apps folder and create webpack alias for them with the app name.
|
11 |
|
12 |
|
13 | ## Why?
|
14 |
|
15 | If you need to start using Webpack on a Django organized project it can be a pain. Static files are usually organized per django app, and communication between them using relative paths can soon become messy.
|
16 | This way you can generate Webpack alias for all Django apps automatically and let Webpack handle the messy part for you.
|
17 |
|
18 |
|
19 | ## Install
|
20 |
|
21 | ```ssh
|
22 | npm i -D django-apps-webpack-alias
|
23 | ```
|
24 |
|
25 |
|
26 | ## Running
|
27 |
|
28 | ```js
|
29 | const djangoAppsAlias = require('django-apps-webpack-alias');
|
30 |
|
31 | // in webpack alias config just spread it (or Object.assign with other alias entries)
|
32 | alias: {
|
33 | ...djangoAppsAlias({ options })
|
34 | },
|
35 | ```
|
36 |
|
37 | Available options:
|
38 | - dir [default 'apps'] path to directory holding the apps
|
39 | - prefix [default '@app:'] each app alias prefix, for instance for auth app it will generate ``` @app:auth ```
|
40 |
|
41 | All aliases point to app/static/app/js directory.
|
42 |
|
43 |
|
44 | ## License
|
45 |
|
46 | MIT.
|
47 |
|
\ | No newline at end of file |