I am currently using Jekyll for a medium size company website with a mix of static content and content imported from an external CMS. We build up pages from a number of reusable blocks/sections - not very unusual at all.
However, currently to add a new “component” we need to:
- Create a new include with the HTML
- (In a different place) create a new stylesheet
- Include the stylesheet in the master one (we use jekyll assets)
- (In a different place, if required) create a new Javascript file
- Include the javascript filr in the master one
This works, but has two drawbacks:
- Adding a new reusable component requires a large number of files to be added, all in different locations
- Either every page needs to include all CSS and JavaScript, or we need to manually keep track of which sections are supported with what type of pages.
What I’d love to see ideally is a mechanism where you can create and include a component that brings with it dependencies from JavaScript and CSS. If such a component had been included at least once, then it’s matching assets would automatically be included in the master ones (stylesheet or JavaScript files).
I’ve seen https://github.com/rustygeldmacher/jekyll-contentblocks which goes some way towards accomplishing the above, but I’m not sure if it’s possible to combine with jekyll-assets so that you get a single minified CSS and JavaScript file included per page.
Has anyone done something like the above, and if so using what tools? Are there any plans on supporting it natively in Jekyll?