4 ms·
Rails uses an asset pipeline package called sprockets. You throw everything in a special directory and it wraps it all up and packages it nicely for you. This a
by debaserab2 10y ago
Rails uses an asset pipeline package called sprockets. You throw everything in a special directory and it wraps it all up and packages it nicely for you. This also gives you SASS and coffee compilation by default.
Sprockets handles minification and cache invalidation for you.
If you don't mind the opinionated approach to your javascript and stylesheets, it works fine. If you just need to sprinkle in some javascript on top of your site, it's fantastic. If you intend for your app to be javascript heavy, a lot of people rip out sprockets altogether and fallback to webpack to handle asset compilation (and I believe the newer Rails version is integrating webpack to play nicer with the rest of the framework)
I can speak from personal experience that Sprockets is a PITA if you want to use npm.
- steveklabnik 10y ago> (and I believe the newer Rails version is integrating webpack to play nicer with the rest of the framework) Yup http://weblog.rubyonrails.org/2017/2/23/Rails-5-1-beta1/ http://weblog.rubyonrails.org/2017/2/23/Rails-5-1-beta1/
- TkTech 10y agoThis is the same in Python, with a bunch of different options. A common one is webassets[1] which has simple integrations for django. [1]: https://webassets.readthedocs.io/en/latest/ https://webassets.readthedocs.io/en/latest/
- helb 10y agoIt's also possible to use Webpack with Django easily. With working hot module reload and everything. https://github.com/owais/django-webpack-loader https://github.com/owais/django-webpack-loader
- utku_karatas2 10y agoFor a similar experience in Django, one should better start with https://github.com/pydanny/cookiecutter-django https://github.com/pydanny/cookiecutter-django instead of the default generated project.