2017 © Pedro Peláez
 

library assetmon

A quick asset monitoring and compression PHP script

image

allenlinatoc/assetmon

A quick asset monitoring and compression PHP script

  • Thursday, October 8, 2015
  • by allenlinatoc
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

ASSETMON

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)

Getting started

1. Configure assetmon.json

Note: assetmon.json is 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)

  1. extensions (array)

    Default: [ "js", "css" ], (*6)

    An array of file extensions to be included in asset monitoring., (*7)

  2. directories (array)

    Default: [ "./" ], (*8)

    An array of existing directories to be included in recursive file monitoring. Symbolic paths are allowed., (*9)

  3. 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)

  4. recursive (boolean)

    Default: true, (*12)

    Boolean value if assets (from directories) will be recursively monitored., (*13)


2. Start 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: assetmon file 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)

Sample scenario

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)

The Versions

08/10 2015

dev-master

9999999-dev

A quick asset monitoring and compression PHP script

  Sources   Download

MIT

The Requires