Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ wp-tests-config.php
/src/wp-includes/css/*-rtl.css
/src/wp-includes/blocks/*
!/src/wp-includes/blocks/index.php
/src/wp-includes/icons
/src/wp-includes/images/icon-library
/src/wp-includes/build
/src/wp-includes/theme.json
/packagehash.txt
Expand Down
47 changes: 27 additions & 20 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ module.exports = function(grunt) {
'wp-includes/css/dist',
'wp-includes/blocks/**/*',
'!wp-includes/blocks/index.php',
'wp-includes/images/icon-library',
// Old location kept temporarily to ensure they are cleaned up.
'wp-includes/icons',
],

Expand Down Expand Up @@ -682,31 +684,35 @@ module.exports = function(grunt) {
},
],
},
'gutenberg-icons': {
'icon-library-images': {
files: [ {
expand: true,
cwd: 'gutenberg/packages/icons/src/library',
src: '*.svg',
dest: WORKING_DIR + 'wp-includes/images/icon-library',
} ],
},
'icon-library-manifest': {
options: {
process: function( content, srcpath ) {
// Remove the 'gutenberg' text domain from _x() calls in manifest.php.
if ( path.basename( srcpath ) === 'manifest.php' ) {
return content.replace(
process: function( content ) {
return content
// Remove the 'gutenberg' text domain from _x() calls.
.replace(
/_x\(\s*([^,]+),\s*([^,]+),\s*['"]gutenberg['"]\s*\)/g,
'_x( $1, $2 )'
)
// Strip the 'library/' prefix from filePath values so they
// resolve correctly relative to wp-includes/images/icon-library/.
.replace(
/'filePath' => 'library\//g,
'\'filePath\' => \''
);
}
return content;
}
},
files: [
{
src: 'gutenberg/packages/icons/src/manifest.php',
dest: WORKING_DIR + 'wp-includes/icons/manifest.php',
},
{
expand: true,
cwd: 'gutenberg/packages/icons/src/library',
src: '*.svg',
dest: WORKING_DIR + 'wp-includes/icons/library/',
},
],
files: [ {
src: 'gutenberg/packages/icons/src/manifest.php',
dest: WORKING_DIR + 'wp-includes/assets/icon-library-manifest.php',
} ],
},
},
sass: {
Expand Down Expand Up @@ -2059,7 +2065,8 @@ module.exports = function(grunt) {
'copy:gutenberg-modules',
'copy:gutenberg-styles',
'copy:gutenberg-theme-json',
'copy:gutenberg-icons',
'copy:icon-library-images',
'copy:icon-library-manifest',
Comment on lines +2068 to +2069
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why drop the "gutenberg-" prefix, since it's kept for the other tasks?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to remove gutenberg- entirely from these steps over time. While they come from the Gutenberg repository, Gutenberg = Core. In my opinion, if we are unable to reference each part of the code base by a descriptive name without a gutenberg- prefix, then we've done something wrong.

] );

grunt.registerTask( 'build', function() {
Expand Down
5 changes: 2 additions & 3 deletions src/wp-includes/class-wp-icons-registry.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,8 @@ class WP_Icons_Registry {
* registry is loaded with those icons listed in the manifest.
*/
protected function __construct() {
$icons_directory = __DIR__ . '/icons/';
$icons_directory = trailingslashit( $icons_directory );
$manifest_path = $icons_directory . 'manifest.php';
$icons_directory = __DIR__ . '/images/icon-library/';
$manifest_path = __DIR__ . '/assets/icon-library-manifest.php';
Comment thread
desrosj marked this conversation as resolved.

if ( ! is_readable( $manifest_path ) ) {
wp_trigger_error(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
/**
* Controller which provides a REST endpoint for the editor to read registered
* icons. For the time being, only core icons are available, which are defined
* in a single manifest file (wp-includes/icons/manifest.php). Icons are
* comprised of their SVG source, a name and a translatable label.
* in a single manifest file (wp-includes/assets/icon-library-manifest.php).
* Icons are comprised of their SVG source, a name and a translatable label.
*
* @since 7.0.0
*
Expand Down
Loading