Suggestion for module and theme extensibility...

35 views
Skip to first unread message

Travis James

unread,
May 11, 2015, 7:27:58 AM5/11/15
to apostr...@googlegroups.com
I really, really like the idea behind Apostrophe with the exception of the lack of module support (for defining and extending functionality) and theme support (for definition global layout, CSS, and overriding view behavior).  I mentioned this in a Github "issue" that has been marked as "refactor", and I have a couple of suggestions based on my current understanding of the code and structure:
  • Make themes AND modules NPM installable by creating a specification for a "theme.json" and "module.json" that provides metadata for the NPM component.  Based on the presence of these files in the "node_modules" directory, you know whether the library is a theme, module, or BOTH potentially.
  • Define a separate NPM installable base module called "Apostrophe Extensibility" or something.  This would contain the base code that a theme or module must derive from.  It would be NPM installable, and its "version" defines the compliance level of the module or theme, so there can be some backward/forward compatibility method (or a method for rejecting a module based on incompatible version).
  • Define a schema for a table that tracks module installation and activation in the database.  This table would also keep track of what database migrations have been performed.
  • Define a module initialization method that includes a step for running database migrations defined by a module.
  • Define a way for a theme to specify a base and alternate layout files that can be specified as the base for views at the site and module level.
  • Define a way for themes to override base views currently defined in the "views" directory of the Apostrophe project.  Encountering a view of the same name installed in the specified "views" directory for a theme overrides the base.
  • Define a way to provide "admin" behavior that can be extended by modules to allow configuration and administration.
  • Define a few extensible "core modules" (for authentication, permissions, routing, etc.) that can be extended by modules via configuration as opposed to requiring a module be written from scratch.
  • Define a way to expose API routes and endpoints to enable SPA behavior and mobile application integration.
I would volunteer to help if you guys think this is a good idea.  I happen to think that adding these features would make Apostrophe the ideal "micro-service" for rendering web content and services.

It could also make the team's work customizing for specific client implementations a lot easier to do in a consistent way.

Thoughts?



Tom Boutell

unread,
May 11, 2015, 7:41:20 AM5/11/15
to apostr...@googlegroups.com
Hi Travis,

I'm a little confused when you mention that Apostrophe has a "lack of module support." Apostrophe does have modules (apostrophe-snippets, apostrophe-blog-2, apostrophe-events...) and these can be extended at project level without modifying the originals.

I think you really mean that you can't package up a bunch of improvements to a bunch of modules in yet another npm module (a "theme") and release it... doing the thing you can do at project level, but in a reusable module.

The ideas you're proposing are pretty much all standard in A2 0.6 (the unstable branch) - but since it's a complete rewrite and we're not done yet, it's not quite ready for prime time yet. Thanks to the moog and moog-require npm modules, the apostrophe npm module contains many Apostrophe "modules" which are core services in just the way you're hoping. You should check out the unstable branch of the apostrophe module and take a good look.

--
You received this message because you are subscribed to the Google Groups "apostrophenow" group.
To unsubscribe from this group and stop receiving emails from it, send an email to apostropheno...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--


THOMAS BOUTELL, DEV & OPS
P'UNK AVENUE | (215) 755-1330  |  punkave.com

Tom Boutell

unread,
May 11, 2015, 7:41:58 AM5/11/15
to apostr...@googlegroups.com
(I should clarify: the moog-require module does not yet have the "improve" feature that is critical to implement theme modules, but it will.)

Stefan Aebischer

unread,
Sep 17, 2016, 5:46:38 PM9/17/16
to apostrophenow
Hi Tom,

are there any news to this topic?

I would like to bundle an apostrophe theme. Did that feature already land? If yes could you give me any hints?

Thanks Stefan

Tom Boutell

unread,
Sep 18, 2016, 11:32:10 AM9/18/16
to apostr...@googlegroups.com
Hi Stefan, I just moved this discussion back to github issues where it's a lot easier to get into code examples. Good news: themes are now possible! However, it's a little awkward at the moment, and your thoughts on the best syntax to paper over that awkward bit are appreciated.


To unsubscribe from this group and stop receiving emails from it, send an email to apostrophenow+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--


THOMAS BOUTELL, SUPPORT LEAD
Reply all
Reply to author
Forward
0 new messages