Serve Javascript/CSS with a Laravel Route

For a quick solution to serving up a Javascript or CSS file using Laravel routes, i.e., take a look at the following snippet.

public function serve_js()
    $js_content = View::make('javascript.client-js');

    return Response::make($js_content, 200)
        ->header('Content-Type', 'application/javascript');

You could put this in a function within the RouteController file.

A file exists in app/views/javascript/ named client-js.php. This file only contains the javascript needed to be served.

This code can be adapted to serve CSS as well, just change
Content-Type to be text/css.