Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Asset Manager #23

Merged
merged 4 commits into from
Jul 8, 2019
Merged

Add Asset Manager #23

merged 4 commits into from
Jul 8, 2019

Conversation

QWp6t
Copy link
Member

@QWp6t QWp6t commented Jul 4, 2019

I might rework the config a bit. Right now it's set up in such a way as to make it easy to add multiple manifests via config, but I'm not sure how frequently that would actually get utilized.

I borrowed the term "strategy" from Symfony. I like it. ¯\_(ツ)_/¯

The @asset() directive and asset() helper function both accept a 2nd parameter now that specifies the name of a manifest. So if a plugin registers a manifest, for example, that plugin can now use those helpers by specifying the name used in registering.

// register the 'my-plugin' manifest
app('assets')->register('my-plugin', $manifest);
{{-- access 'my-plugin' via @asset() directive --}}
@asset('images/logo.png', 'my-plugin')
// access 'my-plugin' manifest via asset() helper function
wp_enqueue_script('my-plugin', asset('scripts/bundle.js', 'my-plugin')->uri(), null, null, true);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant