Code Monkey home page Code Monkey logo

asseticanesthetic's Introduction

AsseticAnesthetic

An abstraction layer to enable managing of assets via a config array. A different way of implementing Assetic.

Installation

Installation is via Composer. Add the following to your composer.json file.

{
    "require": {
        "rob-mccann/asseticanesthetic": "0.1"
    }
}

Run composer install

Features

  1. Generate assets based on configuration
  2. Keeps MVC, no need for <script src="assets.php">
  3. Quick to install and use
  4. Ideal for small, quick projects where delivery is a higher requirement than raw performance

Usage

This project is framework independent. You can use it in almost any PHP project. First, you'll need to create a new object and pass it in our wonderful config array (see the examples to see what to pass in here).

$assets = new \AsseticAnesthetic\SimpleAssetManager($config);

You can then call $assets->renderJs() and $assets->renderCss() to render the HTML tags.

Most of the time, you'll want to load $config from your frameworks Config class. In Laravel and FuelPHP, it's something along the lines of $config = Config::read('assets').

Enabling / Disabling groups

Before you call the render functions, you can override your config to enable or disable groups.

// the following will enable jQuery UI if it exists, but
// will then disable the jquery-ui css from being processed and shown
$assets->enable('jquery-ui');
$assets->disable('jquery-ui', SimpleAssetManager::CSS);

Todo

  1. Write proper tests
  2. Implement more filters
  3. Improve documentation

asseticanesthetic's People

Contributors

rob-mccann avatar

Watchers

 avatar  avatar  avatar

Forkers

wacesredky

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.