Webloader require filter – addon for better assets management
Notice: This thread is very old.
- srigi
- Nette Blogger | 558
I've made a little filter for Webloader for requiring JS & Coffee assets in you files. Idea originates from Ruby on Rails assets pipeline (provided by Sprockets gem) where you can require (or import) other JS files.
Imagine this Nette app layout:
app/
assets/
scripts/
libs/
ajaxPool.js
homepage.js
bower_components/
jquery/
dist/
jquery.js
log/
temp/
www/
When using Webloader you probably have this in
your layout.latte
...
<body>
{include content}
{control js}
</body>
With this filter installed you can do this
homepage.js
//= require ../../bower_components/jquery/dist/jquery.js
//= require_tree libs
// ... code of homepage.js
This really helps to build more complex frontends in you Nette apps. Hope you
enjoy it.
Cheers, srigi.