jekyll-bootstrap icon indicating copy to clipboard operation
jekyll-bootstrap copied to clipboard

Easy way to update theme - a rake task?

Open antitoxic opened this issue 11 years ago • 5 comments

I'm in the scenario where I'm developing my own theme. Of course the most clear way to do it is from the git repo at _theme_packages. However after I do a pull/commit to my theme repo (not the blog repo) I cant easily re-apply them.

I would have expected that rake theme:install name="theme" would overwrite theme files and thus update theme but it keep asking me whether I want to overwrite each file.

Is it possible to provide an override argument for the install task? Something like rake theme:install name="jb-svbtle" --force

Or make a separate task theme:update ?

antitoxic avatar May 03 '13 19:05 antitoxic

Good idea! Yes of course, the task just tries to be cautious so so as to not inadvertently overwrite files/work. But your use case is sound.

BTW I've realized the theme API is rather convoluted in general. I'm thinking of abandoning the whole "track themes in parallel" approach and just have it behave more inline with the stock jekyll strategy.

In other words, jekyll doesn't have themes, just layouts, and static assets. So when you "install" a theme, you'll just 1:1 copy the files over to those native directories. The only thing wrong with that is that once they are in your jekyll blog, they effectively are "no longer a theme". What I mean is if you installed another theme, there may be collisions and you'd be expected to account for this beforehand. Also I'm pretty sure versioning (of the theme itself) would be too hard because now you'd have two sources of files: the theme itself (tracked repo) and the copies generated into your theme.

Making the API simpler means it would be easier to deploy themes into your blog, but harder to track changes over the long-term. My thought is that very few people are obsessed with changing themes so it's why I'm thinking to make it easier.

What do you think?

plusjade avatar May 03 '13 19:05 plusjade

Applying theme files directly onto your project as you are planning to do sounds a bit "dirty". There might not only be collisions but some leftovers from previous themes. However thinking about it, even at the moment this is the case, right?

I just checked the raketask code (i'm not a ruby dev but i can make out what it does) and it seems installation is just copying files to main directory anyway so as a workaround i might just cp -r ./* ./<blog>/

For me you either keep the current way theme management works or remove it. I mean cp -r ./* ./<blog>/ does the same thing right? So I can just checkout my theme to a different dir and then copy it over the blog.

I would keep the current theme management but instead of cloning I would add themes as submodules so that when I commit stuff:

  1. I don't have duplicated files in the repo.
  2. I still have reference to the theme.

Right now , jekyll doesn't support symlinks of includes due to security reasons. In a perfect world jekyll would support some sort of deployment script that enables describing symlink creation. And for the required security: only symlinks that point inside the blog would be allowed.

Then themes can be then symlinked but we are not there yet.

antitoxic avatar May 03 '13 19:05 antitoxic

I have a few ideas around this to support https://bootswatch.com/ themes. Not sure it will help in your scenario, but comes closer to your comment:

I would keep the current theme management but instead of cloning I would add themes as submodules so that when I commit stuff:

  1. I don't have duplicated files in the repo.
  2. I still have reference to the theme.

groundh0g avatar Mar 15 '15 10:03 groundh0g

While my work on this is promising, I think it's too big a risk (too many changes, too little time to test, and really more of a feature than a simple fix) to include in the v0.4.0 milestone. Bumping to v0.5.0.

v0.4.0 - https://github.com/plusjade/jekyll-bootstrap/issues?utf8=%E2%9C%93&q=milestone%3A%22v+0.4.0%22+ v0.5.0 - https://github.com/plusjade/jekyll-bootstrap/issues?utf8=%E2%9C%93&q=milestone%3A%22v+0.5.0%22+

groundh0g avatar Mar 27 '15 02:03 groundh0g

Moving Rakefile tasks to new v 0.6.0 release.

groundh0g avatar Oct 18 '15 10:10 groundh0g