-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ed3a43c
commit 20f1e19
Showing
1 changed file
with
15 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Development Helpers | ||
|
||
## Automatic Asset Minification | ||
|
||
Frontend bundlers can be complex and time-consuming. That's why I prefer to use RockMigrations for this task. | ||
|
||
Let's consider a scenario where you're developing a new module and you want to include some JavaScript. Assume the JavaScript file is located at /site/modules/MyModule/myscript.js | ||
|
||
```php | ||
// In an autoload module, you can place this in the init() method | ||
$rm = rockmigrations(); | ||
$rm->minify("/path/to/MyModule/myscript.js"); | ||
``` | ||
|
||
This action will produce a compressed version of the file, named myscript.min.js, which can be loaded wherever required. You can continue developing within myscript.js and a compressed version will be regenerated on every page load - but only if the file has been modified and only if you are a superuser, to avoid unnecessary overhead in production. |