dev-master
9999999-devA quick asset monitoring and compression PHP script
MIT
The Requires
- php >=5.4.0
- mrclay/minify >=2.2.1
Wallogit.com
2017 © Pedro Peláez
A quick asset monitoring and compression PHP script
An open-source automated web asset monitoring and compilation tool written in PHP., (*1)
This tool recursively monitors and compiles all web assets so that web applications will have to load one single file., (*2)
assetmon.json
Note:
assetmon.jsonis the default configuration file of assetmon., (*3)
The snippet below is the default content of assetmon.json:, (*4)
{
"extensions": [
"js",
"css"
],
"directories" : [
"./"
],
"destination" : "./assets",
"recursive" : true
}
Configuration directives, (*5)
extensions (array)Default:
[ "js", "css" ], (*6)
An array of file extensions to be included in asset monitoring., (*7)
directories (array)Default:
[ "./" ], (*8)
An array of existing directories to be included in recursive file monitoring. Symbolic paths are allowed., (*9)
destination (string)Default:
"./assets", (*10)
The path to destination folder. If path does not exist, it will automatically be created. Symbolic paths are allowed., (*11)
recursive (boolean)Default:
true, (*12)
Boolean value if assets (from directories) will be recursively monitored., (*13)
assetmon
Copy assetmon to your current working directory and make sure that assetmon.json is properly configured and is in the same directory., (*14)
Note:
assetmonfile is a GZip compressed PHP archive, (*15)
Optionally, you can specify the configuration to be used through config argument., (*16)
Console command syntax, (*17)
$ php assetmon [config]
If you work with an existing assetmon.json config file, you can follow the simple syntax below:, (*18)
$ php assetmon/assetmon
The output asset files will vary based on what is specified in extensions and destination., (*19)
Example, (*20)
Given the sample configuration below:, (*21)
{
"extensions": [
"js",
"css"
],
"directories" : [
"./resources",
"./dev/resources"
],
"destination" : "./public/assets",
"recursive" : true
}
In this example, it will do a recursive monitoring and compilation of js and css files., (*22)
The process starts by checking if directories ./resources and ./dev/resources exists., (*23)
Only existing directories/paths will be processed in recursive monitoring., (*24)
Outputs expected are ./public/assets/all.js and ./public/assets/all.css, respectively., (*25)
Note: Whether the script found such file extensions from the given directories, it will still produce the mentioned files with respect to the specified
extensions., (*26)
A quick asset monitoring and compression PHP script
MIT