generator-chisel 2.3.1 → 2.3.2

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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  <!-- INSERT-NEW-ENTRIES-HERE -->
4
4
 
5
+ ## <small>2.3.2 (2025-12-16)</small>
6
+
7
+ - make icons module optional ([94e4c6c](https://github.com/xfiveco/generator-chisel/commit/94e4c6c))
8
+
5
9
  ## <small>2.3.1 (2025-12-16)</small>
6
10
 
7
11
  - add wp interactivity api support, optimize css build, refactor webpack config ([319d822](https://github.com/xfiveco/generator-chisel/commit/319d822))
@@ -59,6 +59,15 @@ final class ThemeHelpers {
59
59
  return (string) get_bloginfo( 'name' );
60
60
  }
61
61
 
62
+ /**
63
+ * Check if icons module should be used.
64
+ *
65
+ * @return bool
66
+ */
67
+ public static function should_use_icons_module(): bool {
68
+ return defined( 'CHISEL_USE_ICONS_MODULE' ) && CHISEL_USE_ICONS_MODULE;
69
+ }
70
+
62
71
  /**
63
72
  * Generate BEM class names with modifiers
64
73
  *
@@ -81,6 +81,7 @@ final class Twig implements InstanceInterface, HooksInterface {
81
81
  $this->register_function( $twig, 'bem', array( $this, 'bem' ) );
82
82
  $this->register_function( $twig, 'breadcrumbs', array( $this, 'breadcrumbs' ) );
83
83
  $this->register_function( $twig, 'get_icon', array( $this, 'get_icon' ) );
84
+ $this->register_function( $twig, 'should_use_icons_module', array( $this, 'should_use_icons_module' ) );
84
85
 
85
86
  return $twig;
86
87
  }
@@ -318,4 +319,13 @@ final class Twig implements InstanceInterface, HooksInterface {
318
319
  public function get_icon( array $args ): string {
319
320
  return Components::get_icon( $args );
320
321
  }
322
+
323
+ /**
324
+ * Check if icons module should be used
325
+ *
326
+ * @return bool
327
+ */
328
+ public function should_use_icons_module(): bool {
329
+ return ThemeHelpers::should_use_icons_module();
330
+ }
321
331
  }
@@ -10,6 +10,7 @@
10
10
  "devcontainer:up": "npm run --silent devcontainer -- up --workspace-folder ../../..",
11
11
  "devcontainer:enter": "/usr/bin/env bash ../../../.devcontainer/exec bash",
12
12
  "devcontainer:start": "/usr/bin/env bash ../../../.devcontainer/exec npm run --silent start",
13
+ "//icons-module": "Add --use-icons-module to start and build-scripts jobs to enable icons module. Also requires scss and wp-config configuration.",
13
14
  "start": "chisel-scripts start --experimental-modules",
14
15
  "dev": "npm run --silent start",
15
16
  "build-scripts": "chisel-scripts build --experimental-modules",
@@ -24,11 +25,11 @@
24
25
  "twigcs": "cross-env vendor/bin/twigcs --config=twig_cs.php"
25
26
  },
26
27
  "dependencies": {
27
- "swiper": "^11.1.10"
28
+ "swiper": "^11.1.10",
29
+ "@wordpress/interactivity": "^6.36.0"
28
30
  },
29
31
  "devDependencies": {
30
32
  "@wordpress/scripts": "^31.1.0",
31
- "@wordpress/interactivity": "^6.36.0",
32
33
  "chisel-scripts": "*",
33
34
  "cross-env": "^7.0.3"
34
35
  },
@@ -0,0 +1 @@
1
+ /* Must be present for icons module config, whether enabled or not */
@@ -1,7 +1,14 @@
1
1
  @use '../tools/theme' as *;
2
2
 
3
+ /*
4
+ * Settings
5
+ */
3
6
  $scrollbar-width: 15px;
4
7
  $root-font-size: 16px;
8
+
9
+ /*
10
+ * Layout settings
11
+ */
5
12
  $breakpoints: (
6
13
  small: 480px,
7
14
  msmall: 640px,
@@ -22,5 +29,13 @@ $gaps: (
22
29
  'xlarge': get-gap('xlarge'),
23
30
  'big': get-gap('big'),
24
31
  );
32
+
33
+ /*
34
+ * Icons
35
+ */
25
36
  $static-icons: ('minus', 'plus', 'arrow-right', 'arrow-left');
26
37
  $animated-icons: ('loader');
38
+ $multicolor-icons: ();
39
+
40
+ // Icons module. Also requires packacke.json and wp-config configuration.
41
+ $use-icons-module: false;
@@ -1,5 +1,7 @@
1
1
  @use 'sass:map';
2
+ @use 'sass:list';
2
3
  @use '../settings/icon-settings' as *;
4
+ @use '../settings/' as *;
3
5
 
4
6
  @mixin icon-svg($name, $multicolor: false, $animated: false) {
5
7
  display: block;
@@ -8,17 +10,31 @@
8
10
  content: '';
9
11
 
10
12
  $icons-path: '../../assets/icons';
13
+ $icon-path: null;
14
+
15
+ @if $use-icons-module {
16
+ $icon-path: '#{$icons-path}/icons.svg#icon-#{$name}-view';
17
+ } @else {
18
+ $icon-path: '#{$icons-path}-source/#{$name}.svg';
19
+ }
11
20
 
12
21
  @if $multicolor {
13
- background-image: url('#{$icons-path}/icons.svg#icon-#{$name}-view');
22
+ @if list.index($multicolor-icons, $name) {
23
+ background-image: url($icon-path);
24
+ }
25
+
14
26
  background-repeat: no-repeat;
15
27
  background-size: contain;
16
28
  } @else {
17
29
  background-color: var(--o-icon-color, currentcolor);
18
30
  @if $animated {
19
- mask: url('#{$icons-path}/animated/#{$name}.svg');
31
+ @if list.index($animated-icons, $name) {
32
+ mask: url('#{$icons-path}/animated/#{$name}.svg');
33
+ }
20
34
  } @else {
21
- mask: url('#{$icons-path}/icons.svg#icon-#{$name}-view');
35
+ @if list.index($static-icons, $name) {
36
+ mask: url($icon-path);
37
+ }
22
38
  }
23
39
 
24
40
  mask-repeat: no-repeat;
@@ -26,7 +42,7 @@
26
42
  mask-size: contain;
27
43
  }
28
44
 
29
- @if map.has-key($o-icon-icons, 'icon-#{$name}') {
45
+ @if $use-icons-module and map.has-key($o-icon-icons, 'icon-#{$name}') {
30
46
  width: map.get($o-icon-icons, 'icon-#{$name}') * 1em;
31
47
  } @else {
32
48
  width: 1em;
@@ -31,9 +31,11 @@ $_animated-icons: settings.$animated-icons;
31
31
  display: inline-flex;
32
32
  }
33
33
 
34
- @each $icon, $width-ratio in $o-icon-icons {
35
- &--#{$icon} {
36
- width: $width-ratio * 1em;
34
+ @if settings.$use-icons-module {
35
+ @each $icon, $width-ratio in $o-icon-icons {
36
+ &--#{$icon} {
37
+ width: $width-ratio * 1em;
38
+ }
37
39
  }
38
40
  }
39
41
 
@@ -14,9 +14,15 @@ color: string // css color for the icon
14
14
  {% set inline_class = inline ? 'o-icon--inline' : '' %}
15
15
  {% set icon_variant_class = is_color ? 'o-icon--color' : 'o-icon--mono' %}
16
16
  {% set rectangle_class = rectangle ? 'o-icon--icon-' ~ name : '' %}
17
- {% set icon_prefix = 'icon-' %}
18
- {% set icon_name = icon_prefix ~ name %}
19
- {% set icon_path = fn('get_template_directory_uri') ~ '/assets/icons/icons.svg' ~ '#' ~ icon_name ~ '-view' %}
17
+
18
+ {% if should_use_icons_module() %}
19
+ {% set icon_prefix = 'icon-' %}
20
+ {% set icon_name = icon_prefix ~ name %}
21
+ {% set icon_path = fn('get_template_directory_uri') ~ '/assets/icons/icons.svg' ~ '#' ~ icon_name ~ '-view' %}
22
+ {% else %}
23
+ {% set icon_path = fn('get_template_directory_uri') ~ '/assets/icons-source/' ~ name ~ '.svg' %}
24
+ {% endif %}
25
+
20
26
  {% set bg_style_variant = is_color ? 'background-image' : 'mask-image' %}
21
27
  {% set color_style_variant = is_css ? 'color' : 'color' %}
22
28
  {% set color_style = color ? color_style_variant ~ ': ' ~ color ~ ';' : '' %}
@@ -1,5 +1,5 @@
1
1
  module.exports = {
2
- 'chisel-scripts': '2.1.1',
2
+ 'chisel-scripts': '2.1.2',
3
3
  'chisel-shared-utils': '2.0.0-alpha.1',
4
- 'generator-chisel': '2.3.1',
4
+ 'generator-chisel': '2.3.2',
5
5
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generator-chisel",
3
- "version": "2.3.1",
3
+ "version": "2.3.2",
4
4
  "description": "A generator for scaffolding front-end and WordPress projects",
5
5
  "bin": {
6
6
  "chisel": "bin/chisel.js"
@@ -37,5 +37,5 @@
37
37
  "tinyqueue": "^2.0.3",
38
38
  "update-notifier": "^4.1.0"
39
39
  },
40
- "gitHead": "eeef8803f7213be257ef9a48b02a1dc1790d2409"
40
+ "gitHead": "54768b8dd93e3773c3659f28445c9c6d76a2819c"
41
41
  }