Skip to content

Instantly share code, notes, and snippets.

@arjan
Last active December 10, 2015 14:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save arjan/4450884 to your computer and use it in GitHub Desktop.
Save arjan/4450884 to your computer and use it in GitHub Desktop.
rebarizing zotonic
Make each module and each site an Erlang (library) app.
This means that each module should be structured like this:
├── dispatch
├── ebin
├── lib
│   ├── css
│   ├── images
├── src
│   ├── actions
│   ├── controllers
│   ├── filters
│   ├── scomps
│   ├── services
│   ├── support
│   └── validators
├── templates
│   ├── phone
│   ├── tablet
│   ├── tests
│   └── text
├── tests
└── translations
└── template
This way, modules and sites compile with the rebar {subdirs} feature.
@arjan
Copy link
Author

arjan commented Jan 4, 2013

We can even move templates, translations, dispatch into priv/

@mmzeeman
Copy link

mmzeeman commented Jan 4, 2013

Sounds very logical.

Some thoughts. Some modules can have deps of their own, so you probably need a dep directory too.

Who will be responsible for scanning (and compiling) the templates? Handing over the dispatch table, translations and stuff from the lib dir? The zotonic app could do that itself by calling code:priv_dir(mod_base) and use that as a starting point to collect what it needs. We could also let the module apps do that with the help of core library calls.

@kaos
Copy link

kaos commented Jan 5, 2013

Nice!

+1 for letting the modules do it with the help of calls to the core functions. This way, the paths need not be fixed indefinetly, since you can pass in a starting point and other options, per module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment