{"id":29150312,"url":"https://github.com/humanmade/asset-loader","last_synced_at":"2025-06-30T23:10:12.806Z","repository":{"id":34847710,"uuid":"180062004","full_name":"humanmade/asset-loader","owner":"humanmade","description":"PHP utilities for WordPress to aid including dynamic Webpack-generated assets in themes or plugins.","archived":false,"fork":false,"pushed_at":"2025-03-10T15:43:13.000Z","size":231,"stargazers_count":28,"open_issues_count":12,"forks_count":4,"subscribers_count":17,"default_branch":"main","last_synced_at":"2025-06-14T08:11:57.641Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://humanmade.github.io/asset-loader/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/humanmade.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-08T03:23:35.000Z","updated_at":"2024-12-12T12:34:28.000Z","dependencies_parsed_at":"2024-08-29T12:56:22.974Z","dependency_job_id":"57cb5cc0-52dc-4845-b167-202e0ed5c6be","html_url":"https://github.com/humanmade/asset-loader","commit_stats":{"total_commits":137,"total_committers":12,"mean_commits":"11.416666666666666","dds":0.2773722627737226,"last_synced_commit":"8df3bb56b0bc1c809af45be2a210494ba3234519"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/humanmade/asset-loader","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/humanmade%2Fasset-loader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/humanmade%2Fasset-loader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/humanmade%2Fasset-loader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/humanmade%2Fasset-loader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/humanmade","download_url":"https://codeload.github.com/humanmade/asset-loader/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/humanmade%2Fasset-loader/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260968289,"owners_count":23090120,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-30T23:10:12.094Z","updated_at":"2025-06-30T23:10:12.737Z","avatar_url":"https://github.com/humanmade.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Asset Loader\n\nThis plugin exposes functions which may be used within other WordPress themes or plugins to aid in detecting and loading assets generated by Webpack, including those served from local `webpack-dev-server` instances.\n\n[![Build Status](https://travis-ci.com/humanmade/asset-loader.svg?branch=main)](https://travis-ci.com/humanmade/asset-loader)\n\n## Usage\n\nThis library is designed to work in conjunction with a Webpack configuration (such as those created with the presets in [@humanmade/webpack-helpers](https://github.com/humanmade/webpack-helpers)) which generate an asset manifest file. This manifest associates asset bundle names with either URIs pointing to asset bundles on a running DevServer instance, or else local file paths on disk.\n\n`Asset_Loader` provides a set of methods for reading in this manifest file and registering a specific resource within it to load within your WordPress website. The primary public interface provided by this plugin is a pair of methods, `Asset_Loader\\register_asset()` and `Asset_Loader\\enqueue_asset()`. To register a manifest asset call one of these methods inside actions like `wp_enqueue_scripts` or `enqueue_block_editor_assets`, in the same manner you would have called the standard WordPress `wp_register_script` or `wp_enqueue_style` functions.\n\n```php\n\u003c?php\nnamespace My_Theme\\Scripts;\n\nuse Asset_Loader;\n\nadd_action( 'enqueue_block_editor_assets', __NAMESPACE__ . '\\\\enqueue_block_editor_assets' );\n\n/**\n * Enqueue the JS and CSS for blocks in the editor.\n *\n * @return void\n */\nfunction enqueue_block_editor_assets() {\n  Asset_Loader\\enqueue_asset(\n    // In a plugin, this would be `plugin_dir_path( __FILE__ )` or similar.\n    get_stylesheet_directory() . '/build/asset-manifest.json',\n    // The handle of a resource within the manifest. For static file fallbacks,\n    // this should also match the filename on disk of a build production asset.\n    'editor.js',\n    [\n      'handle'       =\u003e 'optional-custom-script-handle',\n      'dependencies' =\u003e [ 'wp-element', 'wp-editor' ],\n    ]\n  );\n\n  Asset_Loader\\enqueue_asset(\n    // In a plugin, this would be `plugin_dir_path( __FILE__ )` or similar.\n    get_stylesheet_directory() . '/build/asset-manifest.json',\n    // Enqueue CSS for the editor.\n    'editor.css',\n    [\n      'handle'       =\u003e 'custom-style-handle',\n      'dependencies' =\u003e [ 'some-style-dependency' ],\n    ]\n  );\n}\n```\n\n## Documentation\n\nFor complete documentation, including contributing process, visit the [docs site](https://humanmade.github.io/asset-loader/).\n\n## License\n\nThis plugin is free software. You can redistribute it and/or modify it under the terms of the [GNU General Public License](LICENSE) as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhumanmade%2Fasset-loader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhumanmade%2Fasset-loader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhumanmade%2Fasset-loader/lists"}