Stolz / Assets

An ultra-simple-to-use assets management library for PHP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Complete docs with instructions to use collections

rusjoan opened this issue · comments

Have lost hours before have understood how to load JS and CSS assets from appropriate collection.
So I suppose it's better to complete docs with such instructions:

To load JS or CSS from "foo" collection just use:
Assets::add("foo")->css()
or
Assets::add("foo")->js()

Don't forget to call "echo" or use in a template.

The same using Blade:
{!! Assets::add("foo")->css() !!}

Also maybe it's a good idea to add one more method as Assets::collection() to do the same task?

commented

@rusjoan I'm sorry I took you time to figure out how to use the library.IMHO the docs are pretty clear. They give you exact examples and also they encourage to read the API which lists all the available methods with extended comments on each.

There is only one method to add assets, no matter if it's CSS, JS or collection:

Assets::add('name');

It's true when the method is first described collections are not mentioned but later, on collections specific section, several full examples are given. Also, in the API docs, the docblock of add() mentions collections. I will update the readme file to mention the collections though.

Regarding the 'echo' call, I don't know what you mean since it is already stated:

In your views/layouts
To generate the CSS tags
echo Assets::css();
To generate the JavaScript script tags
echo Assets::js();

OK, I got u.

But still sure that it's not a bad idea to add 2 more lines such as:
{!! Assets::add("collection")->css() !!}
{!! Assets::add("collection")->js() !!}
to specific docs section.

Thanks!