django-webpack / django-webpack-loader

Transparently use webpack with django
MIT License
2.52k stars 342 forks source link

Convenience management command #3

Closed mixxorz closed 9 years ago

mixxorz commented 9 years ago

Hey, thanks for the work you did with webpack loader. It's working great.

I have a feature suggestion. Maybe we could include a convenience management command for running webpack --watch along with runserver. Something along the lines of

python manage.py webpack

which will start webpack in watch mode along with runserver.

This is how I used to do it with grunt. https://github.com/mixxorz/generator-django-kaiju/blob/master/app/templates/kaiju/apps/core/management/commands/gruntserver.py

It's so that you don't need two terminals running when you want your live reloading static assets along with Django's development server.

owais commented 9 years ago

One of my biggest reason to write the library was to avoid wrapping javascript tools with Python. I don't think it is a big deal to open a new terminal. Different people will have different way of running the webpack. Some will use watch mode, some will use dev-server or something else. If we add a management command, then we'll promote one way over the other and when the JS community comes up with a better way to do this, our way of doing things will be outdated.

Also, it makes things hard to debug to wrap 2 servers in a single command. It'll be harder to see the output of each command clearly when both run in the same process/shell. I don't like wrapping things and hiding the details from users.

You can BTW configure your packages.json to run both django webserver and webpack when you run npm start. See https://docs.npmjs.com/misc/config#per-package-config-settings or continue to use a custom management command.

The whole webpack thing is too flexible to be wrapper as a single command without adding too many new configuration options.

I see what you are trying to do but it is not worth it IMO. I think we should leave running webpack to the users.

mixxorz commented 9 years ago

Alright that sounds reasonable. :smile:

owais commented 9 years ago

:)