jekyll-tabler 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7f2f8acca77d940b511b6504685dc8d199ec3994cbc909aa5dfc87d722ea1ca3
4
- data.tar.gz: bb79c09d09e5613f42d6b984023af5482181d698ae1c9c119478afc764a8496f
3
+ metadata.gz: 8fbc565a41d55a6ad7a36ea94f708b985dac791edb9fa5efa37ee876bed42899
4
+ data.tar.gz: 9381aad432d89f180047d0491e71158cfa2c9e4baa76993d04f69d848ad063eb
5
5
  SHA512:
6
- metadata.gz: 47ea8e92733ea94a8c108e09e383a73550d344b0b53b0a0e4c95d1b005ddbb6e8b37f4077f66dc2a91656f13e5b986104bbc377ac2f14a40b798b46e2ddb069a
7
- data.tar.gz: 72161204eb80ca0f73b844b80bc2d55e977c6ac0958a96b037fafeef0adaef1f135963a02508e937ab318e506804079669aae5e57e7b84dda90ee90214180e28
6
+ metadata.gz: aadce9601cab434019c20d0fafcb75552eff830c6c640c7d908409c7962bd37a443ab198bbbd48ad34d694150fc3a03cc4b88482e52aee9f322be5fe6177a689
7
+ data.tar.gz: 7c7ed3d1f7cf9388cf0bcd69a7b1647bbb13406d5d01eb71bdc846d0687e6b762c6220ea60bb52bbba8ba3e5e63756b40e820b74f1fab08e202aad267479e850
data/README.md CHANGED
@@ -9,6 +9,9 @@
9
9
 
10
10
  [Tabler Icons](https://tabler.io/icons) plugin for Jekyll site as liquid tag.
11
11
 
12
+ > [!WARNING]
13
+ > If you are using a released version up to `0.1.2`, see [Performance note for older versions](#performance-note-for-older-versions). Those releases re-load and re-parse the icon YAML files on every `{% tabler %}` and `{% tabler_filled %}` render, which can slow down builds on sites that generate many pages.
14
+
12
15
  ## Installation
13
16
 
14
17
  Install the gem and add to the application's Gemfile by executing:
@@ -66,13 +69,13 @@ Liquid variables are supported for all arguments, including top-level names like
66
69
  With default size and color
67
70
 
68
71
  ```liquid
69
- {% tabler brand-github %}
72
+ {% tabler ti-brand-github %}
70
73
  ```
71
74
 
72
75
  With custom size and color
73
76
 
74
77
  ```liquid
75
- {% tabler brand-github size=36 color=#673ab8 %}
78
+ {% tabler ti-brand-github size=36 color=#673ab8 %}
76
79
  ```
77
80
 
78
81
  - **Github filled icon**
@@ -80,15 +83,55 @@ Liquid variables are supported for all arguments, including top-level names like
80
83
  With default size and color
81
84
 
82
85
  ```liquid
83
- {% tabler_filled brand-github %}
86
+ {% tabler_filled ti-brand-github %}
84
87
  ```
85
88
 
86
89
  With custom size and color
87
90
 
88
91
  ```liquid
89
- {% tabler_filled brand-github size=36 color=#673ab8 %}
92
+ {% tabler_filled ti-brand-github size=36 color=#673ab8 %}
90
93
  ```
91
94
 
95
+ ### Getting Liquid tag
96
+
97
+ You can search for icon Liquid tags, adjust the size or color, and copy the result from <https://phothinmg.github.io/jekyll-tabler/>.
98
+
99
+ ## Performance note for older versions
100
+
101
+ Released versions up to `0.1.2` are affected by the [uncached `YAML.load_file` issue](https://github.com/phothinmg/jekyll-tabler/issues/2).
102
+ If you use this plugin together with page-generating plugins such as `jekyll-paginate-v2` autopages, every `{% tabler %}` and `{% tabler_filled %}` render triggers a full disk read and YAML parse of the icon data files.
103
+ On sites with many generated pages, that repeated work can noticeably slow down builds.
104
+
105
+ If you are using one of those released versions, add the following workaround in your site's `_plugins` directory. This patch was suggested by [Sri Harsha Chilakapati](https://github.com/sriharshachilakapati).
106
+
107
+ `_plugins/tabler_cache.rb`
108
+
109
+ ```ruby
110
+ # frozen_string_literal: true
111
+
112
+ # Monkey-patch jekyll-tabler to cache YAML icon data.
113
+ # The original `tabler_icons` method calls YAML.load_file on every render,
114
+ # re-reading and re-parsing a 956KB file each time. This caches the result
115
+ # so each file is loaded exactly once per build.
116
+
117
+ module Jekyll
118
+ module Tabler
119
+ @tabler_icon_data = {}
120
+
121
+ def self.tabler_icons(type)
122
+ @tabler_icon_data[type] ||= begin
123
+ data_path = File.join(
124
+ Gem.loaded_specs["jekyll-tabler"].full_gem_path,
125
+ "assets",
126
+ "#{type}.yml"
127
+ )
128
+ YAML.load_file(data_path)
129
+ end
130
+ end
131
+ end
132
+ end
133
+ ```
134
+
92
135
  ## Contributing
93
136
 
94
137
  Bug reports and pull requests are welcome on GitHub at <https://github.com/[USERNAME]/jekyll-tabler>. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/jekyll-tabler/blob/master/CODE_OF_CONDUCT.md).