<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/blade-s-once-pushonce-and-prepend-for-clean-asset-management-eqlvfsjwt" -->

---
title: Blade's @once, @pushOnce, and @prepend for Clean Asset...
description: Blade directives @once, @pushOnce, and @prepend help avoid duplicating script and style tags when a component is rendered multiple times on a page, such as a...
canonical: https://daily.dev/posts/blade-s-once-pushonce-and-prepend-for-clean-asset-management-eqlvfsjwt
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Blade's @once, @pushOnce, and @prepend for Clean Asset Management | daily.dev
og:description: Blade directives @once, @pushOnce, and @prepend help avoid duplicating script and style tags when a component is rendered multiple times on a page, such as a...
og:url: https://daily.dev/posts/blade-s-once-pushonce-and-prepend-for-clean-asset-management-eqlvfsjwt
og:image: https://api.daily.dev/og/posts/EqlVFSJwt.png
og:image:alt: Blade's @once, @pushOnce, and @prepend for Clean Asset Management
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Blade's @once, @pushOnce, and @prepend for Clean Asset Management

**[PHP Architect](https://daily.dev/sources/phparchitect)** · [@shocm](https://daily.dev/shocm) · 1 min read · 0 upvotes · 0 comments

## Summary

Blade directives @once, @pushOnce, and @prepend help avoid duplicating script and style tags when a component is rendered multiple times on a page, such as a rating-stars component used repeatedly in a product grid. @once ensures a block of markup, like an Alpine.js snippet, only renders a single time regardless of how many component instances exist, keeping the rendered HTML clean.

## Content

A common Blade component pattern: a <x-rating-stars> component that needs a small Alpine.js snippet to handle hover states. Render that component once on a page and it works fine. Render it 12 times in a product grid, and if the script tag lives inside the component's view, it gets duplicated 12 times in the rendered HTML. @once exists specifically for this.

https://laravelmagazine.com/blades-once-pushonce-and-prepend-for-clean-asset-management

## Similar posts on daily.dev

- [The Blaze Directive](https://daily.dev/posts/the-blaze-directive-zjhxk4xr0) · Larablog · 1 upvotes · 0 comments
- [3 Useful Svelte/Sveltekit Features](https://daily.dev/posts/3-useful-svelte-sveltekit-features-yxpguyydy) · Atomic Spin · 1 upvotes · 0 comments
- [Asset pipelines: just say no](https://daily.dev/posts/asset-pipelines-just-say-no-b4lyss4g9) · RUBYLAND · 0 upvotes · 0 comments
- [Styles in Eleventy \(Again\)](https://daily.dev/posts/styles-in-eleventy-again--ldo8helev) · Kitty says hi. · 5 upvotes · 0 comments

---

Tags: [#php](https://daily.dev/tags/php), [#laravel](https://daily.dev/tags/laravel)

[View this post on daily.dev](https://daily.dev/posts/blade-s-once-pushonce-and-prepend-for-clean-asset-management-eqlvfsjwt)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"DiscussionForumPosting","mainEntityOfPage":"https://daily.dev/posts/blade-s-once-pushonce-and-prepend-for-clean-asset-management-eqlvfsjwt","headline":"Blade's @once, @pushOnce, and @prepend for Clean Asset Management","text":"Blade directives @once, @pushOnce, and @prepend help avoid duplicating script and style tags when a component is rendered multiple times on a page, such as a rating-stars component used repeatedly in a product grid. @once ensures a block of markup, like an Alpine.js snippet, only renders a single time regardless of how many component instances exist, keeping the rendered HTML clean.","url":"https://daily.dev/posts/blade-s-once-pushonce-and-prepend-for-clean-asset-management-eqlvfsjwt","datePublished":"2026-08-28T16:14:36.350Z","dateModified":"2026-08-28T16:14:54.650Z","author":{"@type":"Person","name":"Eric Johnson","url":"https://daily.dev/shocm","image":"https://media.daily.dev/image/upload/s--EPMJ-a-K--/f_auto/v1755890250/avatars/avatar_y7ct3dSEp45NFSALYHve6?_a=BAMClqZW0","description":"PHP Architect team member. I am powered by 16-year-old single malt Scotch and baseball.","worksFor":{"@type":"Organization","name":"php[architect]","logo":"https://res.cloudinary.com/daily-now/image/upload/s--10MwB_VH--/f_auto/v1726147436/companies/phparch"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"EndorseAction"},"userInteractionCount":450}},"image":"https://media.daily.dev/image/upload/s--wZHYQE-p--/f_auto/v1787933679/posts/EqlVFSJwt?_a=BAMAMicg0","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"isPartOf":{"@type":"WebPage","url":"https://daily.dev/squads/phparchitect","name":"PHP Architect"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"PHP Architect","item":"https://daily.dev/squads/phparchitect"},{"@type":"ListItem","position":3,"name":"Blade's @once, @pushOnce, and @prepend for Clean Asset Management"}]}
```

