Currently, DocPad is doing too many things:
- It is a static site generator
- It is a dynamic web server
- It is a document parser
- It is a document database
- It is a document query system
- It is a rendering system
- It is a plugin environment
- Including a home for content management plugins
- Including a home for content importers
That’s the reason why we’ve struggled defining DocPad for so long. It’s time we change this. The biggest change here is to revaluate our goals. For 2013 our goals were:
- Become a plugin environment for importers and content management systems/interfaces
- Create a REST API plugin so that content management systems can then interact with docpad which can then interact with the database which can then interact with the file system
- However, if we are on a remote environment, we also got to create a Commit Plugin that will also listen to the changes, and commit any changes to a git repo, then push that git repo to a web server - and hope that the web server isn’t on an ephemeral file system and doesn’t reset between changes and their push.
- Somehow develop content exporters so we can export content to other database systems (including the file system)
This is absurd. It means that DocPad also becomes an ORM on top of all that it was before.
It really should have been this:
- We utilise a popular external database system
- We develop a standard for the schema that DocPad will use, other SSGs will use, and Content Plugins can use
- DocPad then queries the database for changed documents and re-renders them, applying the renderings to the database
That way:
- Content Management Systems can be developed for the content without depending on DocPad
- Importers can be written without depending on DocPad
- Exporters can be written without depending on DocPad
This means there is the following pieces:
- There is a blackboxed utility for watching the filesystem and importing it into the database
- There is a blackboxed utility for generation, that comprises of:
- There is a blackboxed utility for querying the database
- There is a blackboxed utility for rendering the results of the query
- There is a blackboxed utility for writing the rendered results back to the database
- There is a blackboxed utility for writing the rendered results to the file system when desired
- There is a blackboxed utility for creating a web server on the database
- There is a blackboxed utility for reading the configuration
- There is a blackboxed utility for creating an event system
- There are blackboxed utilities for regenerating changes:
- There is a blackboxed utility for receiving a notification, updating the database, and telling the generation utility to generate
- There is a blackboxed utility for watching the database,and on changes, regenerating the changes
- There is a blackboxed utility for adding a web admin control centre to the above system, instead of just a CLI
- Tying these individual blackboxed utilities together, will create the dynamic static-site generator we have come to love
Then outside of these core, there will be:
- There is a blackboxed content management system(s) that interacts with the database directly
- There are blackboxed importer scripts for a whole bunch of different services that read in a feed, and convert it into the database format, then write it to the database
This makes a lot more sense, as it means rather than a highly coupled system, instead DocPad is comprised of tiny little independent modules (aka blackboxed modules).
While we can utilise a lot of the existing code for this, it will be breaking changes all over the place probably.
Considerations:
- When the database system is asynchronous, how do we do templating? Perhaps ES6 will have a solution here? Or we could use the way the partials plugin does it, which is inserting a place holder into the template synchronously that is then replaced with the actual data when it arrives asynchronously.
- This will be 1-2 years of work before we have something stable for everyday use. That’s a lot of funding and a lot of time. We need a guarantee that the investment of our time is going to be worthwhile - and that we can still afford to thrive during that time (not just live…).
Thoughts?
This proposal will deprecate the following topics/issues:
- Commit Plugin - no longer needed
- Exporters / Sources - now handled externally
- Importer Support - now handled externally
- Tumblr Importer - instead of injecting into DocPad, it will be an independent utility that will inject into the database directly, which DocPad will discover has changed and will regenerate
This proposal will close the following topics/issues:
- Stream Content - depending on how the async templating is solved, this may or may not be useful
- Forget Content - this is a half-way compromise of async data retrieval of templating - it lazily removes unused content from memory, whereas with this proposal unused content would greedily be removed asap - issue is still useful