Skip to content

Commit 3e01434

Browse files
committed
Added basic documentation
1 parent 05242bc commit 3e01434

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

.env-sample

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
COMBINE_BASEDIR=/app/public/
1+
COMBINE_BASEDIR=/var/www/html/
22
COMBINE_DISABLE_FILE_EXISTS=false
33
COMBINE_DISABLE_MINIFY=false

README.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,31 @@
1+
[![Author](https://img.shields.io/badge/author-Daniel%20M.%20Hendricks-lightgrey.svg?colorB=9900cc&style=flat-square)](https://www.danhendricks.com/?utm_source=github.com&utm_medium=campaign&utm_content=button&utm_campaign=php-combine-scripts)
2+
[![License](https://img.shields.io/github/license/dmhendricks/php-combine-scripts.svg?style=flat-square)](https://github.com/dmhendricks/php-combine-scripts/blob/master/LICENSE)
3+
[![DigitalOcean](https://img.shields.io/badge/hosting-Digital%20Ocean-green.svg?style=flat-square&label=hosting&colorB=0152FF)](https://m.do.co/t/8a88362f5683?utm_source=github.com&utm_medium=campaign&utm_content=button&utm_campaign=dmhendricks%2Fphp-combine-scripts)
4+
[![Twitter](https://img.shields.io/twitter/url/https/github.com/dmhendricks/php-combine-scripts.svg?style=social)](https://twitter.com/danielhendricks)
5+
16
# PHP Combine Scripts
27

3-
:construction: This is a work-in-progress. Inspired by [jsDelivr](https://www.jsdelivr.com/features#combine), it can be used to combine scripts passed to it via URI.
8+
A simple PHP script to combine and minify multiple JS or CSS files passed via URI, inspired by [jsDelivr](https://www.jsdelivr.com/features#combine).
9+
10+
## Setup
11+
12+
1. Clone or unzip the files to a directory off of your web root. For example, `/combine/`. Change to that directory.
13+
1. `composer install`
14+
1. Rename `.env-sample` to `.env`. Change the `COMBINE_BASEDIR` to match your web root.
15+
1. Configure your web server to rewrite URLs, as shown in the examples below. Change the `/combine/` and `/minify/` paths as desired.
16+
17+
### Nginx
18+
19+
```nginx
20+
# Rewrite combine/minify URLs
21+
rewrite ^/combine/(.*)$ /combine/index.php?scripts=$1;
22+
rewrite ^/minify/(.*)$ /combine/index.php?minify=true&scripts=$1;
23+
```
24+
25+
### Apache
26+
27+
```apache
28+
# Rewrite combine/minify URLs
29+
RewriteRule "^/combine/(.*)$" "/combine/index.php?scripts=$1"
30+
RewriteRule "^/minify/(.*)$" "/combine/index.php?scripts=$1"
31+
```

combine.php renamed to index.php

File renamed without changes.

0 commit comments

Comments
 (0)