jekyll-heroicons 0.3.0 → 0.4.0

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: 3685591a1423c6c548b5e6a3381c8559a141c87c11e0e5c8db082bb5ba9df456
4
- data.tar.gz: 4f4e3948c4d4b07d5bdd3f9c1974b7d50ec9c79e59749b5953df26f7069829e8
3
+ metadata.gz: 1ea6e91e6cb36a520dca76e702ba049bace4d58ca10d9b4e052835d0326c0152
4
+ data.tar.gz: 2920e68dfc8f15f74915288bce410bd3ef9dd8cdfb02a3db977c9ef565f59846
5
5
  SHA512:
6
- metadata.gz: aa85bec0a59401be1a498665dc13cbcd77935dcdedaa7e0cecefed90d3d679247e408e7694feb08a12b1c8839d82e2df72a55f7763fab379809d63e7901a5292
7
- data.tar.gz: 7b616f08a1d3e57adb75dafcfb17b8aec4420cae5ac8be676e0c48e8b88ffdb00d296b5946d4332f1d58ad949fb477cbe45173f8090841bc146ae7828492438c
6
+ metadata.gz: f9903507c9e0ebb0ec11078792689b8f3aa82544583000934e066bb254e059cfe0595e067cf58303b1540e167d857f9004c632e79ca84f5cccc2dadfeea7d372
7
+ data.tar.gz: 8cf3485c9eea35f1b84fd1d103ae14e3b259c5acb2d609ecd33cfc4ff5a4bc89a18217f5da8ecd7d150b3d5c70fc54298dc33bbaac50613e6346ff03640b742a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Jekyll-Heroicons
2
2
 
3
+ ## 0.4.0
4
+ - Add default variant as solid.
5
+ - Adding "disable_default_class" attribute to a tag, to avoid adding default classes to the icon.
6
+ ## 0.3.1
7
+ - Fix Site.configuration retrieval.
3
8
  ## 0.3.0
4
9
  - We can define in _config.yml default variant and default classes for each variant.
5
10
  ## 0.2.1
data/README.md CHANGED
@@ -25,7 +25,34 @@ This is heavily inspired by https://github.com/jclusso/heroicons
25
25
  ```
26
26
 
27
27
  ## Usage
28
- Configure default settings in `_config.yml`:
28
+ ```liquid
29
+ {% heroicon bell %}
30
+ ```
31
+ Heroicons comes in 4 variants: `solid`, `outline`, `mini`, and `micro`. The default variant is `solid`.
32
+ This can be changed through configuration in `_config.yml`:
33
+
34
+ ```ruby
35
+ heroicons:
36
+ variant: 'solid'
37
+ ```
38
+
39
+ Another way to provide variant and override defaults defined in config is to pass 'variant' to liquid tag:
40
+ ```liquid
41
+ {% heroicon bell variant: "mini" %}
42
+ ```
43
+
44
+ It's also possible to provide classes to the icon:
45
+ ```liquid
46
+ {% heroicon bell class: "text-red-500" %}
47
+ ```
48
+
49
+ Any other attributes will be passed to the SVG tag as well. As example:
50
+
51
+ ```liquid
52
+ {% heroicon bell class: "text-red-500" aria-hidden: true height:32 aria-label:hi %}
53
+ ```
54
+ ## Configuration
55
+ Besides variants, it's also possible to define default classes for each variant. Here is a recommended default configuration for `_config.yml`:
29
56
 
30
57
  ```ruby
31
58
  heroicons:
@@ -38,17 +65,10 @@ heroicons:
38
65
  }
39
66
  ```
40
67
 
41
- And then you can use:
42
-
43
- ```liquid
44
- {% heroicon bell class:"right left" %}
45
- ```
68
+ This default class will be applied to every icon. You can disable this on a per-icon basis by passing `disable_default_class: true`.
46
69
 
47
- Another way to provide variant would be like so:
48
70
  ```liquid
49
- {% heroicon solid/bell class:"right left"%}
50
- # or
51
- {% heroicon bell variant: "solid" class:"right left"%}
71
+ {% heroicon bell disable_default_class: true %}
52
72
  ```
53
73
 
54
74
  ## Development
@@ -5,6 +5,6 @@ module Liquid; class Tag; end; end
5
5
 
6
6
  module Jekyll
7
7
  class Heroicons < Liquid::Tag
8
- VERSION = "0.3.0"
8
+ VERSION = "0.4.0"
9
9
  end
10
10
  end
@@ -38,15 +38,17 @@ module Jekyll
38
38
 
39
39
  return nil if @symbol.nil?
40
40
 
41
- Icon.new(@symbol, @variant, @options.except(:variant)).raw
41
+ Icon.new(@symbol, @variant, @options.except(:variant, :disable_default_class)).raw
42
42
  end
43
43
 
44
44
  private
45
45
 
46
46
  def config
47
- return {} unless defined?(context) && context.registers[:site]
48
-
49
- context.registers[:site].config["heroicons"]
47
+ @config ||= begin
48
+ Jekyll.configuration.dig("heroicons")
49
+ rescue NoMethodError
50
+ {}
51
+ end
50
52
  end
51
53
 
52
54
  def prepare(markup)
@@ -57,16 +59,17 @@ module Jekyll
57
59
  end
58
60
 
59
61
  def variant(markup)
60
- if (match = markup.split("/")).length > 1
61
- match.first
62
- elsif @options.key?(:variant)
62
+ if @options.key?(:variant)
63
63
  @options[:variant]
64
- else
64
+ elsif config["variant"]
65
65
  config["variant"]
66
+ else
67
+ "solid"
66
68
  end
67
69
  end
68
70
 
69
71
  def prepend_default_classes
72
+ return if @options[:disable_default_class].eql?('true')
70
73
  return unless config.dig("default_class", @variant)
71
74
 
72
75
  if @options[:class]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-heroicons
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stanislav (Stas) Katkov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-09-24 00:00:00.000000000 Z
11
+ date: 2024-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll