Open vinorodrigues opened 1 month ago
PS:
I've started to try to resolve these myself, but I've literally needed to start learning how to code in Ruby, as that's not in my repertoire of languages I've worked on before.
If you'd like to see what I've come up with—and obviously I'd be keen to collaborate (with anyone) on this, or just [have you/them] take over—but keep in mind that I've not accounted for anything of an enterprise-level effort. No unit-testing, no comments—just code churn and hope it works.
Anyway, it's here:
unvino/fork.benbalter.jekyll-remote-theme
, branch vr-propagate-files
Diff here
:bangbang: I've done some of my own use testing and all seams good and working. Would love to see it tried out in the wild ...
I'll hold off on any PR-ing until I get a sanity check on this, and a confirmation that it's working. TY to those willing ;)
Is feature request related to a problem?
No existing problem is related - but these feature have been discussed prior, either in issues or pull requests. These include:
Issues:
69
81
96
100
PR's
89
Description of the solution requested
1. Merge Remote Theme
_data
with Local Site DataDescription:
Enhance the plugin to load data from the remote theme's
_data
directory and merge it with the local site's data (site.data
). The data from the theme would be loaded first, allowing the local site's data to override any matching keys. This ensures that default data provided by the theme can be customized or extended by the site.Use Case:
_data
files.bootstrap.min.css
, but site builders may want to override that URL. This is best managed in a data settings file of the theme that can be overriden.Benefits:
2. Optional Inclusion of Theme Files Based on
_config.yml
Description:
Introduce a new configuration option (
remote_theme_include
) in_config.yml
that allows users to specify a list of files to include from the remote theme if they are not present in the local site. This is particularly useful for optional files like404.html
or custom assets.Use Case:
404.html
page that the site wants to use only if it doesn't have its own.Benefits:
3. Support for Local Themes via
local_theme
ConfigurationDescription:
Add the ability to source themes from a local directory specified by a new
local_theme
key in_config.yml
. This would allow users to use themes stored within their project's directory structure (e.g.,_themes/my_theme_1
), in addition to remote themes. Theremote_theme
key retains precedence if both are specified.Use Case:
Benefits:
Alternatives considered
Data Merging:
I've looked at PR #89, but am not confident that this addresses the merger of exiting data and that of site data. I have not experimented with that hypothesis, but the code just seems too brutal to work.
File Inclusion:
I've not seen this addressed in any code or poroposed code specifically to do with remote themes. Both issues #96 and #69 however ask for functionality that can be addressed with this wholly encapsulated request.
Local Theme Support:
I'm aware that ntkme/jekyll-local-theme exists... but wouldn't it be nice if this could do that too? :)
Additional context
Proposed Implementation Overview
Data Merging:
DataLoader
class that reads data from the theme's_data
directory.site.data
usingJekyll::Utils.deep_merge_hashes
, with local data taking precedence.File Inclusion:
FileIncluder
class that checks for specified files in the local site.Local Theme Support:
LocalTheme
class that handles themes from a local directory.Munger
class to initialize aLocalTheme
instance whenlocal_theme
is specified.