Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Stolz committed Dec 2, 2014
2 parents 0f21782 + ff0c30f commit ae2afb2
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 120 deletions.
27 changes: 17 additions & 10 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,42 +11,49 @@ Assets



Constants


Properties
----------


### DEFAULT_REGEX
### $asset_regex

```
const DEFAULT_REGEX = '/.\.(css|js)$/i'
protected string $asset_regex = '/.\.(css|js)$/i'
```

Regex to match against a filename/url to determine if it is an asset.



* Visibility: **protected**


### CSS_REGEX
### $css_regex

```
const CSS_REGEX = '/.\.css$/i'
protected string $css_regex = '/.\.css$/i'
```

Regex to match against a filename/url to determine if it is a CSS asset.



* Visibility: **protected**

### JS_REGEX

### $js_regex

```
const JS_REGEX = '/.\.js$/i'
protected string $js_regex = '/.\.js$/i'
```

Regex to match against a filename/url to determine if it is a JavaScript asset.




Properties
----------
* Visibility: **protected**


### $public_dir
Expand Down
64 changes: 36 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,12 @@ To preconfigure collections using the config file:

// ... config.php ...
'collections' => array(
'one' => 'one.css',
'two' => ['two.css', 'two.js'],
'external' => ['http://example.com/external.css', 'https://secure.example.com/https.css', '//example.com/protocol/agnostic.js'],
'mix' => ['internal.css', 'http://example.com/external.js'],
'nested' => ['one', 'two'],
'duplicated' => ['nested', 'one.css','two.css', 'three.js'],
'one' => 'one.css',
'two' => array('two.css', 'two.js'),
'external' => array('http://example.com/external.css', 'https://secure.example.com/https.css', '//example.com/protocol/agnostic.js'),
'mix' => array('internal.css', 'http://example.com/external.js'],
'nested' => array('one', 'two'),
'duplicated' => array('nested', 'one.css','two.css', 'three.js'),
),

Let me show you how to use the above collection in different scenarios:
Expand Down Expand Up @@ -201,7 +201,6 @@ 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:** 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
Expand All @@ -219,6 +218,9 @@ will produce:
<link type="text/css" rel="stylesheet" href="css/min/135b1a960b9fed4dd65d1597ff593321.css?12345" />
<script type="text/javascript" src="js/min/5bfed4dd65d1597ff1a960b913593321.js?12345"></script>

If you happend to use NGINX with the [gzip_static](http://nginx.org/en/docs/http/ngx_http_gzip_static_module.html) feature enabled, add the following config option to automatically create a suitable gziped version of the pipelined assets:

'pipeline_gzip' => 12345,

<a id="options"></a>
### Other configurable options
Expand Down Expand Up @@ -278,34 +280,39 @@ You can use the library without using static methods. The signature of all metho
## Sample collections

// jQuery (CDN)
'jquery-cdn' => ['//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js'],
'jquery-cdn' => array('//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js'),

// jQuery UI (CDN)
'jquery-ui-cdn' => [
'jquery-ui-cdn' => array(
'jquery-cdn',
'//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js',
],
'//ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js',
),

// Twitter Bootstrap (CDN)
'bootstrap-cdn' => [
'bootstrap-cdn' => array(
'jquery-cdn',
'//netdna.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css',
'//netdna.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css',
'//netdna.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js'
],
),

// Zurb Foundation (CDN)
'foundation-cdn' => [
'foundation-cdn' => array(
'jquery-cdn',
'//cdn.jsdelivr.net/foundation/5.3.3/css/normalize.css',
'//cdn.jsdelivr.net/foundation/5.3.3/css/foundation.min.css',
'//cdn.jsdelivr.net/foundation/5.3.3/js/foundation.min.js',
'//cdn.jsdelivr.net/foundation/5.4.7/css/normalize.css',
'//cdn.jsdelivr.net/foundation/5.4.7/css/foundation.min.css',
'//cdn.jsdelivr.net/foundation/5.4.7/js/foundation.min.js',
'app.js'
],
),

<a id="troubleshooting"></a>
## Troubleshooting / F.A.Q.

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

First make sure you read this [F.A.Q.](#troubleshooting) and if you still need help [open an issue on GitHub](https://github.com/Stolz/Assets/issues/new) or use your GitHub account to [ask for support here](http://laravel.io/forum/02-17-2014-package-an-ultra-simple-to-use-assets-managementpipeline-package).

<a id="faq_folders"></a>
### Where should I copy my assets files?

Expand Down Expand Up @@ -341,7 +348,7 @@ If you use a massive amount of assets make sure your connection is fast enough a
<a id="faq_config_on_the_fly"></a>
### Can I use multiple instances of the library?

Yes you can but there is no need. Read next question.
Yes you can but there is no need. Read next question. If you still want to use multiple instances, [read how](https://github.com/Stolz/Assets/issues/37#issuecomment-57676554).

<a id="faq_instances"></a>
### Can I change settings on the fly?
Expand All @@ -351,17 +358,18 @@ Yes you can. There is a `config()` public method to change settings on the fly.
echo Assets::add('jquery-cdn')->js();
echo Assets::reset()->add(array('custom.js', 'main.js'))->config(array('pipeline' => true))->js();

<a id="faq_pull_request_not_merged"></a>
### Why my pull requests with *some feature* was not merged?
<a id="faq_to_help"></a>
### How can I contribute?

Remember this is a framework agnostic library, if your PR uses code related to your framework it will not get merged. Also, the main reason for the library to exist is to be easy to use, if your PR involves changing this and makes the library cumbersome to use then it will not get merged.
Send a pull requests to the **develop** branch. Read next question for your PR to have more chances to be accepted.

<a id="faq_to_help"></a>
### How can I help?
<a id="faq_pull_request_not_merged"></a>
### Why my pull requests was not accepted?

Send a pull requests to the `develop` branch. I really hate writing unit tests, any addition to improving test coverage will be very welcome.
Remember, the main reason for the library to exist is to be easy to use. If your PR involves changing this and makes the library cumbersome to use then it will not be accepted.

<a id="faq_support"></a>
### Where can I ask for help/support?
This is a framework agnostic library, if your PR uses code related to your framework it will not be accepted.

If your contribution adds new features make sure to include a proper PHPUnit test for it.

First make sure you read the [F.A.Q.](#troubleshooting) and if you still need help [open an issue on GitHub](https://github.com/Stolz/Assets/issues/new).
Please use PHP_CodeSniffer to make sure your code follows the project coding standards (which is a slightly variation of [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)).
Loading

0 comments on commit ae2afb2

Please sign in to comment.