Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Assetic Laravel Package

bonami-cz/assetic

Assetic is a PHP asset management framework for combining, filtering, and dumping assets like JS and CSS. Supports asset collections, file/glob inputs, metadata (target path, mtime), and a wide range of filters for compilation and minification.

View on GitHub
Deep Wiki
Context7

Building and Dumping Assets

The is the simplest approach to using Assetic. It involves two steps:

  1. Create a PHP script in your web directory that uses the Assetic OOP API to create and output an asset.
  2. Reference that file from your template.

For example, you could create a file in your web directory at assets/javascripts.php with the following code:

use Assetic\Asset\AssetCollection;
use Assetic\Asset\FileAsset;
use Assetic\Filter\Yui\JsCompressorFilter as YuiCompressorFilter;

$js = new AssetCollection(array(
    new FileAsset(__DIR__.'/jquery.js'),
    new FileAsset(__DIR__.'/application.js'),
), array(
    new YuiCompressorFilter('/path/to/yuicompressor.jar'),
));

header('Content-Type: application/js');
echo $js->dump();

In your HTML template you would include this generated Javascript using a simple <script> tag:

<script src="/assets/javascripts.php"></script>

Next: Basic Concepts

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor
spatie/laravel-javascript-views