jekyll-tabler 0.1.2 → 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: e99ea2212c5f02f537759f8895490889cb61b6514473b73ce97763003c77a42c
4
- data.tar.gz: b387879e53a9c6eb72e8e456939c53af2f4e0d56996529c10715ddd3087ff5db
3
+ metadata.gz: 8fbc565a41d55a6ad7a36ea94f708b985dac791edb9fa5efa37ee876bed42899
4
+ data.tar.gz: 9381aad432d89f180047d0491e71158cfa2c9e4baa76993d04f69d848ad063eb
5
5
  SHA512:
6
- metadata.gz: 57be84223f90bd41d94578a56895dca1cb12c7694c6e2627bb509ef048a1d6e7103894cbab0b7cf44a7e4409f21d67606b834ba370fc32b6c73b87b692adee8b
7
- data.tar.gz: 8bcc3e8170ef30c0c0f767038b7505ed3dc6c977888d4f2ac67275d07b144a27a2ddbe7d7f4e78cd574521eb6854c5a405be113946ed22787e7ece5cf4daf5a1
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:
@@ -89,6 +92,46 @@ Liquid variables are supported for all arguments, including top-level names like
89
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).