Skip to content
المشاريع

حول

Jekyll Plugin for Git Hash Retrieval

أدوات التطوير

كيف تُقاس هذه الأرقام

النمو المقاس للنجوم

خلال 24 ساعة
٠
خلال 7 أيام
٠
خلال 15 يومًا
٠
خلال شهر
جارٍ جمع السجل

تغيّر صافي النجوم خلال فترات متداخلة، وليس مجموعًا يوميًا. تبقى القياسات المفقودة فارغة. النجوم تقيس الاهتمام لا جودة البرمجيات.

README.md

الأصل

Git Hash Plugin for Jekyll

rake Gem Version

I use this plugin in my Jekyll-powered blog.

Install it first:

gem install jekyll-git-hash

With Jekyll 2, simply add the gem to your _config.yml gems list:

gems: ['jekyll-git-hash', ... your other plugins]

Or for previous versions, create a plugin file within your Jekyll project's _plugins directory:

# _plugins/jekyll-git-hash.rb
require 'jekyll-git-hash'

Highly recommend to use Bundler. If you're using it, add this line to your Gemfile:

gem "jekyll-git-hash"

The plugin is compatible with Jekyll 3.9.3 and Jekyll 4.3.2.

Use {{ site.data['hash']}} inside your liquid template.

When the site is being generated by Jekyll, the plugin retrieves Git hash of the source code and exposes it as a item in site.data. This feature is very helpful when you want your static resources (CSS, JS, etc.) be reloaded by end users every time you deploy a new version of the site.

For example, in your default.html:

<link rel="stylesheet" href="/css/layout.css?{{ site.data['hash'] }}"/>

The URL will be generated with a suffix at the end. This suffix doesn't change the URL (layout.css will still be accessible by the browser), but it makes the URL unique for the browser when you deploy a new Git revision. All browsers will reload this CSS.

استكشف مشاريع مشابهة ومرتبطة

جارٍ التحميل…