rocket/script

Enqueue scripts, take control of your Javascript

dev-master / 1.0.x-dev 2016-01-02 17:58 UTC

README

Latest Version Software License Build Status Coverage Status Quality Score Total Downloads

In modern web applications, script execution should be done at the end of a page's loading. This class is a very simple wrapper for this: queue scripts and render them when needed

Install

Via Composer

$ composer require rocket/script

Service Provider

\Rocket\UI\Script\Support\Laravel5\ServiceProvider

Middleware

(App\Http\Kernel.php)

\Rocket\UI\Script\Support\Middleware\ScriptMiddleware

Usage

JS::ready(' console.log("you\'re a wizard, Harry!"); ');
JS::ready(' console.log("Dobby is freeeee!"); ');

Will produce

<script>
$(function() {
    console.log("you're a wizard, Harry!");

    //---

    console.log("Dobby is freeeee!");
});
</script>

Testing

All the tests live in the main project.

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.