1.0.6 • Published 5 years ago

django-apps-webpack-alias v1.0.6

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

Django Apps Webpack Alias

Open Source Love license js-semistandard-style package version install size dependecies codecov

Automatically discovery django apps folder and create webpack alias for them with the app name.

Why?

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. This way you can generate Webpack alias for all Django apps automatically and let Webpack handle the messy part for you. If you are using Jest (and you should) also check out django-apps-jest-mapper to follow same naming in both configurations.

Install

npm i -D django-apps-webpack-alias

Running

const djangoAppsAlias = require('django-apps-webpack-alias');

// in webpack alias config just spread it (or Object.assign with other alias entries)
alias: {
    ...djangoAppsAlias({ options })
},

Available options:

  • dir default 'apps' path to directory holding the apps (example: path.resolve(__dirname, 'project/apps'))
  • prefix default '@app:' each app alias prefix, for instance for auth app it will generate @app:auth

All aliases point to app/static/app/js directory.

License

MIT.

1.0.6

5 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.0.0

6 years ago