Download the PHP package hametuha/wp-enqueue-manager without Composer
On this page you can find all versions of the php package hametuha/wp-enqueue-manager. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hametuha/wp-enqueue-manager
More information about hametuha/wp-enqueue-manager
Files in hametuha/wp-enqueue-manager
Package wp-enqueue-manager
Short Description A WordPress library to bulk register assets.
License GPL-3.0-or-later
Informations about the package wp-enqueue-manager
wp-enqueue-manager
Bulk register WordPress assets with specified folder structure. Good shortcut for your theme development.
Installation
Use composer.
Usage
Write dependnecies in your assets(js and css) header as comment.
format is like wpdeps=dependencies
. CSV ready.
This notation will be used for the deps
argument of wp_register_script
(doc) and wp_register_style
(doc).
Operations should be done in init
hook or before. Write codes in your functions.php
.
Javascript
Header file should be like below:
NOTICE: If you use autoprefixer or minify tools, be careful about cleaning up comments.
Then, register them all from your theme or plugin.
Stylesheet
Same as javascript, regsier
And, run register_styles
.
Versionning
If you are a theme or plugin author, it's proper to pass the version of your theme/plugin.
Lazy authors may just pass null
or skip the argument. Then the file modified time will be used as version string.
Localization
For Javascript localization, you can bulk register localization vars.
File name equals js handle name. Camelized handle name should be var name. PHP files should return var array.
For example, if you put my-sample.php
below in l10n
directory.
Registered infromation are below:
- Handle: my-sample
- Var name: MySample
- Var: returned array of file.
So, you can refer PHP variables from JS like this:
License
MIT.