////
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.
////


== javascript



=== Purpose


Includes JavaScript libraries and scripts as well as providing a shorthand for inline JavaScript.


=== Examples


[,xml]
----
<!-- actually imports '/app/js/myscript.js' -->
<g:javascript src="myscript.js" />

<g:javascript>alert('hello')</g:javascript>
----


=== Description


If you do not include a "src" attribute but instead provide a body, the result is an inline script.

If you are doing more advanced JavaScript and asset management we recommend checking out the Asset Pipeline plugin.

Attributes

* `contextPath` (optional) - the context path to use (relative to the application context path). Defaults to "" or path to the plugin for a plugin view or template.
* `src` (optional) - The name of the JavaScript file to import. Will look in /appname/js directory
* `plugin` (optional) - The plugin to look for the JavaScript in


