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 filter to printPublicPath #17

Merged
merged 2 commits into from
Jan 14, 2023

Conversation

derweili
Copy link
Contributor

@derweili derweili commented Feb 7, 2022

This PR adds a filter to the printPublicPath method.

This makes it possible to set publicPath to a custom URL e.g. a CDN as described in #14

Resolves #14

How to use this filter:

add_filter( 'wpackio_print_public_path', 'set_public_path_to_cdn', 10, 3 );

function set_public_path_to_cdn( $public_path, $appName, $outputPath ) {
	if($appName === 'myAppName') {
		return 'https://cdn.example.com/';
	}

	return $public_path;
}

This filter makes it possible to set publicPath to a custom URL e.g. a CDN
Copy link
Owner

@swashata swashata left a comment

Choose a reason for hiding this comment

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

Please make the suggested changes and we can version bump and release.

inc/Enqueue.php Show resolved Hide resolved
@derweili derweili requested a review from swashata January 11, 2023 13:29
@derweili
Copy link
Contributor Author

@swashata hi, would be cool if you could take a look at this. Would love to have this feature. I think all your suggested changes are implemented. If anything needs to be updates, just give me a shout.

README.md Show resolved Hide resolved
@swashata swashata merged commit a40c559 into swashata:master Jan 14, 2023
@swashata
Copy link
Owner

Thanks @derweili this has been released.

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.

Using dynamic Imports with a CDN
2 participants