php - How to call one javascript asset only in laravel? -
in base controller, added 2 asset inside:
asset::script('jquery', 'js/jquery-2.0.0.min.js'); asset::script('test', 'js/test.js'); but when called : asset::script, these 2 .js files loaded. call jquery, not test, how can so? thanks.
you use 2 containers. asset::script('name','path') add script default container. , output whole container later when call asset:scripts() in template file.
you can add different container either test.js or jquery, this:
asset::container('mycontainername')->add('test', 'js/test.js'); then later in template file can output scripts container named "mycontainername" this:
echo asset::container('mycontainername')->scripts(); this isn't same outputting specific script single container, give desired result.
read more containers in official documentation: http://laravel.com/docs/views/assets
Comments
Post a Comment