Giter Club home page Giter Club logo

carabiner's Introduction

Carabiner

JS/CSS Asset management library for CodeIgniter

Note: This project is not in active development. I'm happy to merge pull requests, assuming they make sense and work. Also, tests are a bonus.

Carabiner manages javascript and CSS assets. It will react differently depending on whether it is in a production or development environment. In a production environment, it will combine, minify, and cache assets. (As files are changed, new cache files will be generated.) In a development environment, it will simply include references to the original assets.

Carabiner requires the JSMin and CSSMin libraries included. You don't need to load them unless you'll be using them elsewhise. Carabiner will load them automatically as needed.

Notes: Carabiner does not implement GZIP encoding, because I think that the web server should handle that. If you need GZIP in an Asset Library, AssetLibPro does it. I've also chosen not to implement any kind of javascript obfuscation (like packer), because of the client-side decompression overhead. More about this idea from John Resig. However, that's not to say you can't do it. You can easily provide a production version of a script that is packed. However, note that combining a packed script with minified scripts could cause problems. In that case, you can flag it to be not combined.

Carabiner is inspired by Minify by Steve Clay, PHP Combine by Niels Leenheer and (AssetLibPro)(http://code.google.com/p/assetlib-pro/) by Vincent Esche, among other things.

Read the top of the main library file for usage guidelines.

carabiner's People

Contributors

shaffe-fr avatar tonydewan avatar umefarooq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

carabiner's Issues

Combining Javascript files not ending by a semicolon

When we combine two javascript files that do not end with a semi-colon, a javascript error is raised.
It can happen when libraries like jQuery are used.
Here is a sample.
$(function(){ /// My code})
When using that statement in a single file no error is raised, because the semi-colon (;) is not required, it's only strongly advised.
If we combine another file to this sample an error can be raised.
The fix is easy :
in libraries/carabiner.php at the line 964 and 970, replace
$file_data .= $this->_minify( $flag, $file['dev'] ) . "\n";
and
$file_data .= $this->_get_contents( $r ) ."\n";
by
$file_data .= $this->_minify( $flag, $file['dev'] ) . ";\n";
and
$file_data .= $this->_get_contents( $r ) .";\n";

Module assets

Hi,
There is an option for load assets from module? for example:
the css path is APPPATH.'modules' and we can add modules asset path next like test_module/assets/css/test.css

Check for empty paths

I believe a check should be added to prevent generating HTML references for empty paths, for example:

$css = array('');
$this->carabiner->css($css);
$this->carabiner->display('css');

will output a <link> to the base CSS directory

multiple path for asset directories

right now in carabiner we can define just one directory for js and css assets, can we define multiple directories for the assets like 2 directories has different scripts

public
js - css

private or module specific
js - css

Unable to add uncombined file succesfully

According to the documentation the following format should work:

$this->carabiner->css('home.css', 'screen', 'home.css', FALSE );

I've also tried:

$this->carabiner->css('home.css', 'screen', '', FALSE );

The other files added, which are combined, work and output properly. This particular file is linked as being in the /cache/ directory but no such file exists.

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.