PluginProbe
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance / 3.2.5
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance v3.2.5
4.7.0 4.6.1 4.6.0 4.5.5 4.5.4 4.5.3 4.5.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.5 3.2.6 3.2.7 3.2.9 3.3.0 3.3.1 3.3.2 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.7.0 3.7.1 All 111 releases
wp-optimize / vendor / kriswallsmith / assetic / docs / en / build.md

build.md in WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance 3.2.5, at vendor/kriswallsmith/assetic/docs/en/build.md

33 lines 1012 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 Building and Dumping Assets
2 ---------------------------
3
4 The is the simplest approach to using Assetic. It involves two steps:
5
6 1. Create a PHP script in your web directory that uses the Assetic OOP API to
7 create and output an asset.
8 2. Reference that file from your template.
9
10 For example, you could create a file in your web directory at
11 `assets/javascripts.php` with the following code:
12
13 use Assetic\Asset\AssetCollection;
14 use Assetic\Asset\FileAsset;
15 use Assetic\Filter\Yui\JsCompressorFilter as YuiCompressorFilter;
16
17 $js = new AssetCollection(array(
18 new FileAsset(__DIR__.'/jquery.js'),
19 new FileAsset(__DIR__.'/application.js'),
20 ), array(
21 new YuiCompressorFilter('/path/to/yuicompressor.jar'),
22 ));
23
24 header('Content-Type: application/js');
25 echo $js->dump();
26
27 In your HTML template you would include this generated Javascript using a
28 simple `<script>` tag:
29
30 <script src="/assets/javascripts.php"></script>
31
32 Next: [](concepts.mdBasic Concepts](concepts.md](concepts.md)
33