generator-chisel 2.4.2 → 2.4.4
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 +10 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/README.md +2 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/core/WP/Assets.php +86 -63
- package/lib/commands/create/creators/app/chisel-starter-theme/core/WP/Blocks.php +31 -0
- package/lib/commands/create/creators/app/chisel-starter-theme/package.chisel-tpl.json +2 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/src/design/tools/_screen-readers.scss +2 -2
- package/lib/commands/create/creators/app/chisel-starter-theme/style.chisel-tpl.css +1 -1
- package/lib/commands/create/creators/app/index.js +8 -0
- package/lib/commands/create/packages-versions.js +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
<!-- INSERT-NEW-ENTRIES-HERE -->
|
|
4
4
|
|
|
5
|
+
## <small>2.4.4 (2026-03-20)</small>
|
|
6
|
+
|
|
7
|
+
- Update readme, fix husky overwrite ([a24f08f](https://github.com/xfiveco/generator-chisel/commit/a24f08f))
|
|
8
|
+
- Update theme version ([41ab516](https://github.com/xfiveco/generator-chisel/commit/41ab516))
|
|
9
|
+
|
|
10
|
+
## <small>2.4.3 (2026-03-04)</small>
|
|
11
|
+
|
|
12
|
+
- fix conditional enqueue, add filre hooks for defer, async, preload, add phcbf ([3befdb5](https://github.com/xfiveco/generator-chisel/commit/3befdb5))
|
|
13
|
+
- update theme version ([7292b1a](https://github.com/xfiveco/generator-chisel/commit/7292b1a))
|
|
14
|
+
|
|
5
15
|
## <small>2.4.2 (2026-02-11)</small>
|
|
6
16
|
|
|
7
17
|
- Blocks and patterns cache and render fixes ([576fbe9](https://github.com/xfiveco/generator-chisel/commit/576fbe9))
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Chisel WordPress Theme
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A WordPress starter theme built on [Timber](https://timber.github.io/docs/) (Twig templating), Webpack, and ITCSS. Part of the [Chisel](https://getchisel.co/) development framework — scaffolded automatically via `npx generator-chisel`.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
For full documentation visit [getchisel.co](https://getchisel.co/).
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
@@ -455,7 +455,7 @@ final class Assets {
|
|
|
455
455
|
return $tag;
|
|
456
456
|
}
|
|
457
457
|
|
|
458
|
-
$scripts = array();
|
|
458
|
+
$scripts = apply_filters( 'chisel_async_scripts', array() );
|
|
459
459
|
|
|
460
460
|
if ( $scripts ) {
|
|
461
461
|
foreach ( $scripts as $script_handle ) {
|
|
@@ -481,7 +481,7 @@ final class Assets {
|
|
|
481
481
|
return $tag;
|
|
482
482
|
}
|
|
483
483
|
|
|
484
|
-
$scripts = array();
|
|
484
|
+
$scripts = apply_filters( 'chisel_defer_scripts', array() );
|
|
485
485
|
|
|
486
486
|
if ( $scripts ) {
|
|
487
487
|
foreach ( $scripts as $script_handle ) {
|
|
@@ -507,13 +507,19 @@ final class Assets {
|
|
|
507
507
|
return $tag;
|
|
508
508
|
}
|
|
509
509
|
|
|
510
|
-
$styles_handles =
|
|
511
|
-
'
|
|
510
|
+
$styles_handles = apply_filters(
|
|
511
|
+
'chisel_preload_styles',
|
|
512
|
+
array(
|
|
513
|
+
'wp-block-library',
|
|
514
|
+
)
|
|
512
515
|
);
|
|
513
516
|
|
|
514
|
-
$styles_handles_start_with =
|
|
515
|
-
'
|
|
516
|
-
|
|
517
|
+
$styles_handles_start_with = apply_filters(
|
|
518
|
+
'chisel_preload_styles_start_with',
|
|
519
|
+
array(
|
|
520
|
+
'gform_',
|
|
521
|
+
'block',
|
|
522
|
+
)
|
|
517
523
|
);
|
|
518
524
|
|
|
519
525
|
if ( $styles_handles ) {
|
|
@@ -546,7 +552,7 @@ final class Assets {
|
|
|
546
552
|
$preload_tag = str_replace( "rel='stylesheet'", "rel='preload' as='style'", $tag );
|
|
547
553
|
$tag = $preload_tag . str_replace( "media='all'", "media='print' onload='this.media=\"all\"'", $tag );
|
|
548
554
|
|
|
549
|
-
return $tag;
|
|
555
|
+
return apply_filters( 'chisel_preload_style', $tag );
|
|
550
556
|
}
|
|
551
557
|
|
|
552
558
|
/**
|
|
@@ -561,22 +567,10 @@ final class Assets {
|
|
|
561
567
|
private function register_style( string $handle, string $file_name, array $args ): ?array {
|
|
562
568
|
$asset_data = $this->get_asset( $file_name, 'css' );
|
|
563
569
|
|
|
564
|
-
$src
|
|
565
|
-
$deps
|
|
566
|
-
$ver
|
|
567
|
-
$media
|
|
568
|
-
$condition = isset( $args['condition'] ) ? $args['condition'] : null;
|
|
569
|
-
|
|
570
|
-
// Use condition to determine if the style should be registered. It can be either a boolean or a function.
|
|
571
|
-
if ( $condition !== null ) {
|
|
572
|
-
if ( is_callable( $condition ) ) {
|
|
573
|
-
$condition = call_user_func( $condition );
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
if ( ! $condition ) {
|
|
577
|
-
return null;
|
|
578
|
-
}
|
|
579
|
-
}
|
|
570
|
+
$src = isset( $args['src'] ) ? $args['src'] : $this->get_style_src( $file_name );
|
|
571
|
+
$deps = isset( $args['deps'] ) ? $args['deps'] : array();
|
|
572
|
+
$ver = isset( $args['ver'] ) ? $args['ver'] : $asset_data['version'];
|
|
573
|
+
$media = isset( $args['media'] ) ? $args['media'] : 'all';
|
|
580
574
|
|
|
581
575
|
if ( $asset_data['dependencies'] ) {
|
|
582
576
|
$deps = wp_parse_args( $asset_data['dependencies'], $deps );
|
|
@@ -596,12 +590,11 @@ final class Assets {
|
|
|
596
590
|
}
|
|
597
591
|
|
|
598
592
|
return array(
|
|
599
|
-
'src'
|
|
600
|
-
'deps'
|
|
601
|
-
'ver'
|
|
602
|
-
'media'
|
|
603
|
-
'
|
|
604
|
-
'handle' => $handle,
|
|
593
|
+
'src' => $src,
|
|
594
|
+
'deps' => $deps,
|
|
595
|
+
'ver' => $ver,
|
|
596
|
+
'media' => $media,
|
|
597
|
+
'handle' => $handle,
|
|
605
598
|
);
|
|
606
599
|
}
|
|
607
600
|
|
|
@@ -611,10 +604,22 @@ final class Assets {
|
|
|
611
604
|
* @param string $handle - full script handle.
|
|
612
605
|
* @param array $args
|
|
613
606
|
*
|
|
614
|
-
* @return array
|
|
607
|
+
* @return ?array
|
|
615
608
|
*/
|
|
616
|
-
private function enqueue_style( string $handle, array $args ): array {
|
|
617
|
-
$
|
|
609
|
+
private function enqueue_style( string $handle, array $args ): ?array {
|
|
610
|
+
$condition = isset( $args['condition'] ) ? $args['condition'] : null;
|
|
611
|
+
$inline = isset( $args['inline'] ) ? $args['inline'] : '';
|
|
612
|
+
|
|
613
|
+
// Use condition to determine if the style should be enqueued. It can be either a boolean or a function.
|
|
614
|
+
if ( $condition !== null ) {
|
|
615
|
+
if ( is_callable( $condition ) ) {
|
|
616
|
+
$condition = call_user_func( $condition );
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
if ( ! $condition ) {
|
|
620
|
+
return null;
|
|
621
|
+
}
|
|
622
|
+
}
|
|
618
623
|
|
|
619
624
|
if ( $inline ) {
|
|
620
625
|
wp_add_inline_style( $handle, $inline['data'] );
|
|
@@ -623,7 +628,8 @@ final class Assets {
|
|
|
623
628
|
wp_enqueue_style( $handle );
|
|
624
629
|
|
|
625
630
|
return array(
|
|
626
|
-
'handle'
|
|
631
|
+
'handle' => $handle,
|
|
632
|
+
'condition' => $condition,
|
|
627
633
|
);
|
|
628
634
|
}
|
|
629
635
|
|
|
@@ -639,25 +645,13 @@ final class Assets {
|
|
|
639
645
|
private function register_script( string $handle, string $file_name, array $args ): ?array {
|
|
640
646
|
$asset_data = $this->get_asset( $file_name, 'js' );
|
|
641
647
|
|
|
642
|
-
$src
|
|
643
|
-
$deps
|
|
644
|
-
$ver
|
|
645
|
-
$strategy
|
|
648
|
+
$src = isset( $args['src'] ) ? $args['src'] : $this->get_script_src( $file_name );
|
|
649
|
+
$deps = isset( $args['deps'] ) ? $args['deps'] : array();
|
|
650
|
+
$ver = isset( $args['ver'] ) ? $args['ver'] : $asset_data['version'];
|
|
651
|
+
$strategy = isset( $args['strategy'] ) ? $args['strategy'] : array(
|
|
646
652
|
'in_footer' => true,
|
|
647
653
|
'strategy' => 'defer',
|
|
648
654
|
); // Strategy can be a boolean, which determines if the script should be enqueued in the footer, or an array with the following keys: 'in_footer':boolean and 'strategy':string (defer or async).
|
|
649
|
-
$condition = isset( $args['condition'] ) ? $args['condition'] : null;
|
|
650
|
-
|
|
651
|
-
// Use condition to determine if the script should be registered. It can be either a boolean or a function.
|
|
652
|
-
if ( $condition !== null ) {
|
|
653
|
-
if ( is_callable( $condition ) ) {
|
|
654
|
-
$condition = call_user_func( $condition );
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
if ( ! $condition ) {
|
|
658
|
-
return null;
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
655
|
|
|
662
656
|
if ( $asset_data['dependencies'] ) {
|
|
663
657
|
$deps = wp_parse_args( $asset_data['dependencies'], $deps );
|
|
@@ -666,12 +660,11 @@ final class Assets {
|
|
|
666
660
|
wp_register_script( $handle, $src, $deps, $ver, $strategy );
|
|
667
661
|
|
|
668
662
|
return array(
|
|
669
|
-
'src'
|
|
670
|
-
'deps'
|
|
671
|
-
'ver'
|
|
672
|
-
'strategy'
|
|
673
|
-
'
|
|
674
|
-
'handle' => $handle,
|
|
663
|
+
'src' => $src,
|
|
664
|
+
'deps' => $deps,
|
|
665
|
+
'ver' => $ver,
|
|
666
|
+
'strategy' => $strategy,
|
|
667
|
+
'handle' => $handle,
|
|
675
668
|
);
|
|
676
669
|
}
|
|
677
670
|
|
|
@@ -681,11 +674,23 @@ final class Assets {
|
|
|
681
674
|
* @param string $handle - full script handle.
|
|
682
675
|
* @param array $args
|
|
683
676
|
*
|
|
684
|
-
* @return array
|
|
677
|
+
* @return ?array
|
|
685
678
|
*/
|
|
686
|
-
private function enqueue_script( string $handle, array $args ): array {
|
|
687
|
-
$localize
|
|
688
|
-
$inline
|
|
679
|
+
private function enqueue_script( string $handle, array $args ): ?array {
|
|
680
|
+
$localize = isset( $args['localize'] ) ? $args['localize'] : array();
|
|
681
|
+
$inline = isset( $args['inline'] ) ? $args['inline'] : '';
|
|
682
|
+
$condition = isset( $args['condition'] ) ? $args['condition'] : null;
|
|
683
|
+
|
|
684
|
+
// Use condition to determine if the script should be registered. It can be either a boolean or a function.
|
|
685
|
+
if ( $condition !== null ) {
|
|
686
|
+
if ( is_callable( $condition ) ) {
|
|
687
|
+
$condition = call_user_func( $condition );
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
if ( ! $condition ) {
|
|
691
|
+
return null;
|
|
692
|
+
}
|
|
693
|
+
}
|
|
689
694
|
|
|
690
695
|
if ( $localize ) {
|
|
691
696
|
wp_localize_script( $handle, $localize['name'], $localize['data'] );
|
|
@@ -699,8 +704,9 @@ final class Assets {
|
|
|
699
704
|
$this->set_script_translations( $handle, $args );
|
|
700
705
|
|
|
701
706
|
return array(
|
|
702
|
-
'localize'
|
|
703
|
-
'
|
|
707
|
+
'localize' => $localize,
|
|
708
|
+
'condition' => $condition,
|
|
709
|
+
'handle' => $handle,
|
|
704
710
|
);
|
|
705
711
|
}
|
|
706
712
|
|
|
@@ -727,7 +733,24 @@ final class Assets {
|
|
|
727
733
|
*/
|
|
728
734
|
private function enqueue_style_js_for_dev( string $handle ): void {
|
|
729
735
|
if ( ThemeHelpers::is_fast_refresh() ) {
|
|
730
|
-
|
|
736
|
+
$enqueue = true;
|
|
737
|
+
|
|
738
|
+
if ( $args ) {
|
|
739
|
+
$src = isset( $args['src'] ) ? $args['src'] : '';
|
|
740
|
+
|
|
741
|
+
if ( $src ) {
|
|
742
|
+
$theme = wp_get_theme();
|
|
743
|
+
$theme_name = $theme->get_stylesheet();
|
|
744
|
+
|
|
745
|
+
if ( strpos( $src, $theme_name ) === false ) {
|
|
746
|
+
$enqueue = false;
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
if ( $enqueue ) {
|
|
752
|
+
wp_enqueue_script( 'style-' . AssetsHelpers::get_final_handle( $handle ) );
|
|
753
|
+
}
|
|
731
754
|
}
|
|
732
755
|
}
|
|
733
756
|
|
|
@@ -161,6 +161,7 @@ final class Blocks {
|
|
|
161
161
|
add_filter( 'block_categories_all', array( $this, 'block_categories' ) );
|
|
162
162
|
add_filter( 'timber/locations', array( $this, 'tiwg_files_locations' ) );
|
|
163
163
|
add_filter( 'render_block', array( $this, 'render_block' ), 10, 3 );
|
|
164
|
+
add_filter( 'register_block_type_args', array( $this, 'register_block_type_args' ), 10, 2 );
|
|
164
165
|
|
|
165
166
|
add_filter( 'should_load_separate_core_block_assets', array( $this, 'should_load_separate_core_block_assets' ) );
|
|
166
167
|
add_filter( 'styles_inline_size_limit', array( $this, 'styles_inline_size_limit' ) );
|
|
@@ -292,6 +293,36 @@ final class Blocks {
|
|
|
292
293
|
return $block_content;
|
|
293
294
|
}
|
|
294
295
|
|
|
296
|
+
/**
|
|
297
|
+
* Extend server-registered block attributes with editor-added custom attributes.
|
|
298
|
+
*
|
|
299
|
+
* This keeps REST block renderer validation in sync with JS filters that add
|
|
300
|
+
* custom attributes (e.g. disableBottomMargin in editor mods).
|
|
301
|
+
*
|
|
302
|
+
* @param array $args Block type args.
|
|
303
|
+
* @param string $block_name Registered block name.
|
|
304
|
+
*
|
|
305
|
+
* @return array
|
|
306
|
+
*/
|
|
307
|
+
public function register_block_type_args( array $args, string $block_name ): array {
|
|
308
|
+
if ( strpos( $block_name, 'core/' ) !== 0 && strpos( $block_name, 'chisel/' ) !== 0 ) {
|
|
309
|
+
return $args;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
if ( ! isset( $args['attributes'] ) || ! is_array( $args['attributes'] ) ) {
|
|
313
|
+
$args['attributes'] = array();
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
if ( ! isset( $args['attributes']['disableBottomMargin'] ) ) {
|
|
317
|
+
$args['attributes']['disableBottomMargin'] = array(
|
|
318
|
+
'type' => 'boolean',
|
|
319
|
+
'default' => false,
|
|
320
|
+
);
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
return $args;
|
|
324
|
+
}
|
|
325
|
+
|
|
295
326
|
/**
|
|
296
327
|
* Set inline size limit for the styles. Default wp limit is 20000.
|
|
297
328
|
*
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "<%= app.nameSlug %>",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.3",
|
|
4
4
|
"private": true,
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "<%= app.author %>",
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
"build": "npm run build-scripts && npm run lint && npm run phpcs && npm run twigcs && npm run check-update",
|
|
18
18
|
"add-page": "chisel-scripts add-page",
|
|
19
19
|
"create-block": "chisel-scripts create-block --category=chisel-blocks --namespace=chisel",
|
|
20
|
-
"create-dynamic-block": "npm run create-block --variant=dynamic",
|
|
21
20
|
"wp": "chisel-scripts wp",
|
|
22
21
|
"composer": "chisel-scripts composer",
|
|
23
22
|
"wp-config": "chisel-scripts wp-config",
|
|
24
23
|
"phpcs": "cross-env vendor/bin/phpcs --extensions=php --exclude=Generic.PHP.Syntax",
|
|
24
|
+
"phpcbf": "cross-env vendor/bin/phpcbf --extensions=php --exclude=Generic.PHP.Syntax",
|
|
25
25
|
"twigcs": "cross-env vendor/bin/twigcs --config=twig_cs.php",
|
|
26
26
|
"check-update": "chisel-scripts check-chisel-update",
|
|
27
27
|
"update-chisel": "chisel-scripts chisel-update",
|
package/lib/commands/create/creators/app/chisel-starter-theme/src/design/tools/_screen-readers.scss
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
height: 1px;
|
|
9
9
|
padding: 0;
|
|
10
10
|
overflow: hidden;
|
|
11
|
-
clip:
|
|
11
|
+
clip-path: inset(50%);
|
|
12
12
|
white-space: nowrap;
|
|
13
13
|
border: 0;
|
|
14
14
|
}
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
width: auto;
|
|
25
25
|
height: auto;
|
|
26
26
|
overflow: visible;
|
|
27
|
-
clip:
|
|
27
|
+
clip-path: none;
|
|
28
28
|
white-space: normal;
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Theme URI: https://www.getchisel.co/
|
|
4
4
|
* Author: <%= app.author %>
|
|
5
5
|
* Description: Chisel Wordpress Starter Theme based on Timber library.
|
|
6
|
-
* Version: 2.4.
|
|
6
|
+
* Version: 2.4.4
|
|
7
7
|
* License: GNU General Public License v2 or later
|
|
8
8
|
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
|
9
9
|
* Tags: chisel, custom, starter, theme, WordPress
|
|
@@ -108,6 +108,14 @@ module.exports = async (api) => {
|
|
|
108
108
|
{ cwd: api.resolve(app.themePath) },
|
|
109
109
|
);
|
|
110
110
|
|
|
111
|
+
// Restore prepare script after coding-standards may have overwritten it
|
|
112
|
+
{
|
|
113
|
+
const themePkgPath = api.resolve(app.themePath, 'package.json');
|
|
114
|
+
const themePkg = JSON.parse(await fs.readFile(themePkgPath, 'utf8'));
|
|
115
|
+
themePkg.scripts.prepare = 'chisel-scripts husky-init || node -e ""';
|
|
116
|
+
await fs.writeFile(themePkgPath, JSON.stringify(themePkg, null, 2) + '\n');
|
|
117
|
+
}
|
|
118
|
+
|
|
111
119
|
await api.modifyFile(
|
|
112
120
|
'.devcontainer/devcontainer.json',
|
|
113
121
|
async (body) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "generator-chisel",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.4",
|
|
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": "
|
|
40
|
+
"gitHead": "7cb8498dbf9e63b07393c46d9f1b92a7f721f4e9"
|
|
41
41
|
}
|