2017 © Pedro Peláez
 

library assets

A simple assets library. Combine and minify your JS and CSS assets

image

bradstinson/assets

A simple assets library. Combine and minify your JS and CSS assets

  • Wednesday, December 10, 2014
  • by bradstinson
  • Repository
  • 4 Watchers
  • 18 Stars
  • 740 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 0 Open issues
  • 13 Versions
  • 1 % Grown

The README.md

Assets

Build Status, (*1)

Assets is yet another CSS/JavaScript minificaton and combination library. However, unlike most other libraries (which rely on Assetic), this ones takes a more simplistic approach., (*2)

Assets supports minifying and combining stylesheets and scripts, in an effort to reduce the number and size of http requests needed to load a given page. The generated file is also cached, which prevents an application from having to generate the same file for every new request., (*3)

Basic usage

CSS

CSS files can be added using the following command, where "file1.css" and "file2.css" are the CSS files you want to include, and are located at assets/css/file1.css and assets/css/file2.css., (*4)

Assets::css('file1.css');
Assets::css('file2.css');

You may also submit files as an array., (*5)

Assets::css(array('file1.css', 'file2.css'));

Assets will minify both CSS files and combine them into a single file (which is written to 'assets/cache' directory). The proper tags will then be returned. To include this file in your page, use the following:, (*6)

echo Assets::renderCss();
/*
Returns something like:
<link rel="stylesheet" href="/assets/cache/3cf89b9f723e22c1caf26f8d4d1fdc31.css">
*/

LESS

Less files can be added using the following command, where "file1.less" is the Less file you want to compile, and is located at assets/css/file1.less., (*7)

Assets::less('file1.less');

You may also submit multiple files as an array., (*8)

Assets::css(array('file1.less', 'file2.less'));

Your Less files will be automatically compiled and combined with your CSS files into a single file (which is written to 'assets/cache' directory). The proper tags will then be returned., (*9)

JS

Javascript files can be added using the following command, where "file1.js" and "file2.js" are the javascript files you want to include, and are located at assets/js/file1.js and assets/js/file2.js., (*10)

Assets::js('file1.js');
Assets::js('file2.js');

You may also submit files as an array., (*11)

Assets::js(array('file1.js', 'file2.js'));

Assets will minify both JS files and combine them into a single file (which is written to 'assets/cache' directory). The proper tags will then be returned. To include this file in your page, use the following:, (*12)

echo Assets::renderJs();
/*
Returns something like:
<script src="/assets/cache/9cf2803d8f075cb7d1ad31940738f35e.js"></script>
*/

CoffeeScript

CoffeeScript files can be added using the following command, where "file1.coffee" is the CoffeeScript file you want to compile, and is located at assets/js/file1.coffee., (*13)

Assets::coffee('file1.coffee');

You may also submit multiple files as an array., (*14)

Assets::coffee(array('file1.coffee', 'file2.coffee'));

Your CoffeeScript files will be automatically compiled and combined with your JS files into a single file (which is written to 'assets/cache' directory). The proper tags will then be returned., (*15)

If you would like to generate the CSS and JS tags together, you can call:, (*16)

echo Assets::render();
/*
Which will return:
<link rel="stylesheet" href="/assets/cache/3cf89b9f723e22c1caf26f8d4d1fdc31.css">
<script src="/assets/cache/9cf2803d8f075cb7d1ad31940738f35e.js"></script>
*/

Configuration

By default, this library assumes the following directory structure:, (*17)

assets/
   css/
   js/
   cache/

However, you are now able to adjust the path to the assets directory (if needed):, (*18)

Assets::setPath('public/assets/');

BaseURL

Assets::setBaseurl('/');

Groups

This library currently does not offer support for groups. This is because the project I was working on did not require it. If enough requests are made, this may be added in a future version., (*19)

Thanks

This asset library was inspired by and uses components from the following libraries:, (*20)

Contributing

If you have any issues/complaints/suggestions, let me know and I will see if I can implement them as time permits. Also, pull requests are also welcome., (*21)

The Versions

10/12 2014

dev-master

9999999-dev https://github.com/bradstinson/assets

A simple assets library. Combine and minify your JS and CSS assets

  Sources   Download

MIT

The Requires

 

by Brad Stinson

css assets js minify

10/12 2014

1.1.0

1.1.0.0 https://github.com/bradstinson/assets

A simple assets library. Combine and minify your JS and CSS assets

  Sources   Download

MIT

The Requires

 

by Brad Stinson

css assets js minify

20/03 2013

dev-develop

dev-develop https://github.com/bradstinson/assets

A simple assets library. Combine and minify your JS and CSS assets

  Sources   Download

MIT

The Requires

 

by Brad Stinson

css assets js minify

18/03 2013

1.0.0

1.0.0.0 https://github.com/bradstinson/assets

A simple assets library. Combine and minify your JS and CSS assets

  Sources   Download

MIT

The Requires

 

by Brad Stinson

css assets js minify

13/03 2013

0.0.0

0.0.0.0 https://github.com/bradstinson/assets

A simple assets library. Combine and minify your JS and CSS assets

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Brad Stinson

css assets js minify

04/03 2013

0.0.9

0.0.9.0 https://github.com/bradstinson/assets

A simple assets library. Combine and minify your JS and CSS assets

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Brad Stinson

css assets js minify

28/02 2013

0.0.8

0.0.8.0 https://github.com/bradstinson/assets

A simple assets library. Combine and minify your JS and CSS assets

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Brad Stinson

css assets js minify

23/01 2013

0.0.7

0.0.7.0 https://github.com/bradstinson/assets

A simple assets library. Combine and minify your JS and CSS assets

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Brad Stinson

css assets js minify

22/01 2013

0.0.6

0.0.6.0 https://github.com/bradstinson/assets

A simple assets library. Combine and minify your JS and CSS assets

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Brad Stinson

css assets js minify

07/01 2013

0.0.4

0.0.4.0 https://github.com/bradstinson/assets

A simple assets library. Combine and minify your JS and CSS assets

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Brad Stinson

css assets js minify

10/12 2012

0.0.3

0.0.3.0 https://github.com/bradstinson/assets

A simple assets library. Combine and minify your JS and CSS assets

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Brad Stinson

css assets js minify

10/12 2012

0.0.2

0.0.2.0 https://github.com/bradstinson/assets

A simple assets library. Combine and minify your JS and CSS assets

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

by Brad Stinson

css assets js minify

04/12 2012

0.0.1

0.0.1.0 https://github.com/bradstinson/assets

A simple assets library. Combine and minify your JS and CSS assets

  Sources   Download

MIT

The Requires

 

by Brad Stinson

css assets js minify