Skip to content

Commit

Permalink
Improved docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Stolz committed Jul 9, 2014
1 parent 1867de2 commit 5cb099b
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ All methods that don't generate output will accept chaining:
<a id="api"></a>
### API

There are some methods not documented here. For a **full list of all the availabe methods** please read the provided `API.md` file.
There are some methods not documented here. For a **full list of all the availabe methods** please read the provided [`API.md`](https://github.com/Stolz/Assets/blob/master/API.md) file.

<a id="configuration"></a>
## Configuration
Expand Down Expand Up @@ -202,13 +202,13 @@ Once it's enabled all your assets will be concatenated and minified to a single
This process can take a few seconds depending on the amount of assets and your connection but it's triggered only the first time you load a page whose assets have never been pipelined before. The subsequent times the same page (or any page using the same assets) is loaded, the previously pipelined file will be used giving you much faster loading time and less bandwidth usage.


**Note:** Using the pipeline is recommended only for production environment.
**Note:** For obvious reasons, using the pipeline is recommended only for production environment.

If your assets have changed since they were pipelined use the provided artisan command to purge the pipeline cache

php artisan asset:purge-pipeline

A custom timestamp may be appended to the pipelined assets URL by setting `pipeline` config option to an integer value greather than 1:
To deal with chache issues a custom timestamp may be appended to the pipelined assets URL by setting `pipeline` config option to an integer value greather than 1:

Example:

Expand All @@ -223,6 +223,8 @@ will produce:
<a id="options"></a>
### Other configurable options

For a **full list of all the availabe config options** please read the provided [`API.md`](https://github.com/Stolz/Assets/blob/master/API.md) file.

- `'autoload' => array(),`

Here you may set which assets (CSS files, JavaScript files or collections) should be loaded by default.
Expand All @@ -235,8 +237,6 @@ will produce:

Override default folder for pipelined assets. Don't use trailing slash!.

For a **full list of all the availabe config options** please read the provided `API.md` file.

It is possible to **change any config options on the fly** by passing an array of settings to the `config()` method. Usefull if some assets use a different base directory or if you want to pipeline some assets and skip others from the pipeline. i.e:

{{ Assets::reset()->add('do-not-pipeline-this.js')->js() }}
Expand All @@ -250,7 +250,9 @@ It is possible to **change any config options on the fly** by passing an array o
You can use the library without using static methods. The signature of all methods is the same as described above but using an instance of the class instead.

// Load the library
require '/path/to/Stolz/Assets/Manager.php'; // Also psr-0 autoloadable
require 'vendor/autoload.php';
// or if you didn't use composer
//require '/path/to/Stolz/Assets/Manager.php';

// Set config options
$config = array(
Expand Down Expand Up @@ -318,12 +320,20 @@ You can use the library without using static methods. The signature of all metho

They should be copied to the subfolders you specified with the `css_dir` and `js_dir` config options. Both folders are relative to your webroot/public folder. For package assets it's the same but relative to the `packages` folder within your webroot/public folder.

i.e: Using `Assets::add(['foo.css', 'bar.js', 'somevendor/somepackage:lorem.css', 'anothervendor/anotherpackage:ipsum.js']);` with the default settings and assuming `/myproject/public` is your webroot/public folder then you need to copy your files to:
i.e: Assuming the next scenario:

- You are using the default settings.
- Your webroot/public folder is `/myproject/public`
- Your webroot/public contains:
- /myproject/public/css/foo.css
- /myproject/public/js/bar.js
- /myproject/public/packages/somevendor/somepackage/css/lorem.css
- /myproject/public/packages/anothervendor/anotherpackage/js/ipsum.js

Then to load the assets you should run:

Assets::add(['foo.css', 'bar.js', 'somevendor/somepackage:lorem.css', 'anothervendor/anotherpackage:ipsum.js']);

/myproject/public/css/foo.css
/myproject/public/js/bar.js
/myproject/public/packages/somevendor/somepackage/css/lorem.css
/myproject/public/packages/anothervendor/anotherpackage/js/ipsum.js

<a id="faq_base"></a>
### Why assets work for the main page but not for subpages?
Expand Down Expand Up @@ -358,7 +368,7 @@ Remember this is a framework agnostic library, if your PR uses code related to y
<a id="faq_to_help"></a>
### How can I help?

Send a pull requests. I really hate writing unit tests, any addition to improving test coverage will be very welcome.
Send a pull requests to the `develop` branch. I really hate writing unit tests, any addition to improving test coverage will be very welcome.

<a id="faq_support"></a>
### Where can I ask for help/support?
Expand Down

0 comments on commit 5cb099b

Please sign in to comment.