Download the PHP package davidecesarano/embryo-assets without Composer
On this page you can find all versions of the php package davidecesarano/embryo-assets. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download davidecesarano/embryo-assets
More information about davidecesarano/embryo-assets
Files in davidecesarano/embryo-assets
Package embryo-assets
Short Description Simple PHP library that combines, minify and serves css or javascript files in inline mode or in a bundle file.
License MIT
Homepage https://github.com/davidecesarano/embryo-assets
Informations about the package embryo-assets
Embryo Assets
Embryo Assets is a simple PHP library that combines, minify and serves css or javascript files in inline mode or in a bundle file.
Features
- Files combined, compressed and cached until they are modified.
- Uses an online service provided by Andy Chilton, http://chilts.org/.
- Replace relative path with root public path in css file.
- PSR-7 compatible.
Requirements
- PHP >= 7.1
- A PSR-7 http message implementation and PSR-17 http factory implementation (ex. Embryo-Http)
Installation
Using Composer:
Usage
This will produce:
Now, you may use it in your template file:
Files are combined, compressed and cached in one file. When you modify one file or change array css file, it compiling the file again.
You may quickly test this using the built-in PHP server going to http://localhost:8000.
Use bundle
If you want include bundle file instead of inline mode, be sure the compile file in a public folder (for example, in assets
folder).
Now, you may include the file in <link>
tag:
JS
It's same the CSS example. You must replace css static method with js
static method.
Options
forceBuild(bool $forceBuild): self
If true
build file for every request. Default is false
.
setFilename(string $filename): self
Set the filename. Default is app
.