Skip to content
breakfastcoPublic

About

WordPress plugin. Prevents plugins from loading assets on requests that do not use them. Spiritual successor to csalzano/contact-form-7-fix-asset-loads

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

70 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Julienne

WordPress plugins often enqueue CSS and JS on every front-end request. Julienne unloads those assets unless the current page actually uses them. No settings. Activate it and it works.

Bundled cuts

Each file in cuts/ is one plugin. The file returns an array so shortcodes, blocks, late render hooks, and extra conditions stay readable.

Cut What it unloads unless needed
contact-form-7.php CF7 CSS/JS, plus Blocksy/Astra/Kubelio companion sheets
wpforms.php WPForms CSS/JS, plus Blocksy ct-wpforms-styles
paid-memberships-pro.php PMPro frontend CSS (kept in the head on checkout and PMPro pages)
woocommerce.php WooCommerce CSS/JS, plus common theme companion sheets
easy-digital-downloads.php edd-styles / edd-ajax, plus Astra/OceanWP/Neve/Page Builder Framework companions
elementor.php Theme Elementor companion CSS (left alone when Elementor Pro is active)
svg-support.php DOMPurify / svgs-inline unless style-svg (or force-inline) is in play
google-maps-v3-shortcode.php Maps API printed from wp_head, unless the page has a [map] shortcode
helcim-commerce-for-woocommerce.php Helcim version2.js and reCAPTCHA, unless the page is checkout
column-shortcodes.php Column stylesheet, unless the page has a column shortcode
contact-form-7-honeypot.php Honeypot redirect script, unless the page has a Contact Form 7 form
contact-form-7-multi-step-module.php Multi-step stylesheet and script, unless the page has a Contact Form 7 form
country-phone-field-contact-form-7.php Phone-field stylesheet and scripts, unless the page has a Contact Form 7 form
embed-any-document.php Document viewer assets, unless the page has an embedded document
3d-flipbook-dflip-lite.php Flipbook viewer, unless the page has a [dflip] shortcode
page-list.php Page list stylesheet, unless the page has a list shortcode
search-filter.php Search form styles and scripts, unless the page has a search form
search-filter-pro.php Search form stylesheet and scripts, unless the page has a search form
coblocks.php Animation and extension assets, unless the page has a CoBlocks block
affilininja.php Front-end scripts, unless the page has an AffiliNinja block
structured-content.php Schema stylesheet and script, unless the page has structured content
suretriggers.php Trigger-button stylesheet and script, unless the page has the button
vk-blocks.php Slider script, unless the page has a slider block
wp-recipe-maker.php Recipe stylesheet and script, unless the page has a recipe
wp-rss-aggregator.php Feed lightbox stylesheet, unless the page has a feed
wpcf7-redirect.php Redirect stylesheet and script, unless the page has a Contact Form 7 form
advanced-product-fields-for-woocommerce.php Product-field assets, except on the product, cart, and checkout pages
cf7-conditional-fields.php Conditional-field assets, unless the page has a Contact Form 7 form
formlayer.php Form stylesheet and script, unless the page has a FormLayer form
h5p.php H5P base styles, unless the page has H5P content
interactive-3d-flipbook-powered-physics-engine.php Flipbook loader, unless the page has a book
socialfeeds.php Feed stylesheet and script, unless the page has a social feed
dk-pricr-responsive-pricing-table.php Pricing-table assets, unless the page has a pricing table
team-members.php Team stylesheet, unless the page has a team shortcode
animated-typing-effect.php Typing effect, unless the page has a typed shortcode
bold-timeline-lite.php Timeline assets, unless the page has a timeline
flowpaper-lite-pdf-flipbook.php Flipbook lightbox script, unless the page has a flipbook
frontend-reset-password.php Password-reset assets, unless the page has a reset form
easy-video-player.php Video player, unless the page has a video shortcode
lightweight-grid-columns.php Column grid stylesheet, unless the page has a column shortcode
advanced-backgrounds.php Background stylesheet, unless the page has a background
html-forms.php Form stylesheet, unless the page has an HTML form

We take requests. If you want a cut for another plugin, open an issue or a pull request or send a note at https://breakfastco.xyz/contact.

Generated from scans.json.

Plugins that already load their own assets

  • Advanced Custom Fields loads its field assets when a form or block needs them, so a page without those never gets the field scripts.
  • Elementor already limits elementor-frontend to documents it built. Julienne only removes the Blocksy and Sydney companion stylesheets.
  • Gravity Forms looks at the post content before it enqueues, so a page with no form never gets the form assets.
  • WPForms already gates its own assets unless Load Assets Globally is on. Julienne still removes those assets, plus Blocksy's companion stylesheet.

Install

Julienne is not in the WordPress.org plugin directory, so it does not show up in the plugin search inside your dashboard. Install it from a zip file instead.

  1. Download the zip from breakfastco.xyz/julienne. Leave the file zipped.
  2. In your WordPress dashboard, go to Plugins → Add Plugin and click Upload Plugin at the top of the page.
  3. Choose the zip you downloaded, click Install Now, then Activate Plugin.

That's it. There is nothing to configure.

Updates show up in the dashboard like any other plugin. Julienne asks breakfastco.xyz for the latest version number. The request does not include your site address or any other information about your site.

Register another cut

add_action( 'breakfast_julienne_register', function () {
	Breakfast_Julienne::register( array(
		'id'         => 'some-slider-plugin',
		'active'     => static function () {
			return defined( 'SOME_SLIDER_VERSION' );
		},
		'styles'     => array( 'slick-theme', 'slick-main' ),
		'scripts'    => array( 'slick-main' ),
		'blocks'     => array( 'vendor/slider-block' ),
		'shortcodes' => array( 'slider' ),
	) );
} );

Useful keys:

  • active — bool or callback. Skip the cut when the plugin is absent.
  • styles / scripts — exact enqueue handles.
  • shortcodes / blocks — early (queried post) and late (render) detection. A block value ending in / matches a namespace (pmpro/).
  • filters / actions — extra render hooks that mark the cut used.
  • needles / image_classes — content substrings and <img> classes.
  • needed — extra early condition (pmpro_is_checkout(), force-inline SVG, …).
  • load_styles — bool or callback. CF7 uses this to honor WPCF7_LOAD_CSS.
  • unhook — actions to remove when the queried post does not already need the plugin. Each item is hook, callback, and optional priority.
  • late_markup — HTML printed once, ahead of a late shortcode, after that action was removed.

Drop a matching PHP file in cuts/ instead of calling Breakfast_Julienne::register() if you are shipping the rule with this plugin.

Remove a bundled cut with:

add_filter( 'breakfast_julienne_cuts', function ( $cuts ) {
	unset( $cuts['contact-form-7'] );
	return $cuts;
} );

About

WordPress plugin. Prevents plugins from loading assets on requests that do not use them. Spiritual successor to csalzano/contact-form-7-fix-asset-loads

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages