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

アセットのビルドとダンプ

Asseticを使う一番単純な方法は、次の2ステップからなります。

  1. 公開領域内にPHPスクリプトを作成し、Assetic OOP APIを使用してアセットの作成・出力を行う
  2. テンプレートから上記のファイルを参照する

例えば、公開領域内にassets/javascripts.phpファイルを作成し、 下記のようなコードを記述します。

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();

HTMLテンプレート側では、単に<script>タグを用いて、生成されたJavascriptをインクルードすることになります。

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

Next: コンセプト

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.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
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