Skip to content

Commit 774edf8

Browse files
committed
explain another purpose for the license tag (#109)
1 parent 5565b07 commit 774edf8

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed

content/en/tags-license.md

+34
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ You can use any text to identify the license you are using. If your code uses a
1616
license, consider using the appropriate identifier from the [Software Package Data Exchange (SPDX)
1717
License List][spdx].
1818

19+
Some JavaScript processing tools, such as Google's Closure Compiler, will automatically preserve
20+
any JSDoc comment that includes a `@license` tag. If you are using one of these tools, you may wish
21+
to add a standalone JSDoc comment that includes the `@license` tag, along with the entire text of
22+
the license, so that the license text will be included in generated JavaScript files.
23+
1924
[spdx]: https://spdx.org/licenses/
2025

2126

@@ -31,3 +36,32 @@ License List][spdx].
3136
*/
3237
```
3338
{% endexample %}
39+
40+
{% example "A standalone JSDoc comment with the complete MIT license" %}
41+
42+
```js
43+
/**
44+
* @license
45+
* Copyright (c) 2015 Example Corporation Inc.
46+
*
47+
* Permission is hereby granted, free of charge, to any person obtaining a copy
48+
* of this software and associated documentation files (the "Software"), to deal
49+
* in the Software without restriction, including without limitation the rights
50+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
51+
* copies of the Software, and to permit persons to whom the Software is
52+
* furnished to do so, subject to the following conditions:
53+
*
54+
* The above copyright notice and this permission notice shall be included in all
55+
* copies or substantial portions of the Software.
56+
*
57+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
58+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
59+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
60+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
61+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
62+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
63+
* SOFTWARE.
64+
*/
65+
```
66+
67+
{% endexample %}

tags-license.html

+27
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,40 @@ <h2 id="overview">Overview</h2>
4242
<p>You can use any text to identify the license you are using. If your code uses a standard open-source license, consider using the appropriate identifier from
4343
the <a href="https://spdx.org/licenses/">Software Package Data Exchange (SPDX)
4444
License List</a>.</p>
45+
<p>Some JavaScript processing tools, such as Google&#39;s Closure Compiler, will automatically preserve any JSDoc comment that includes a <code>@license</code> tag. If you are using one of these tools, you may wish to add a standalone JSDoc comment that includes the <code>@license</code> tag, along with the entire
46+
text of the license, so that the license text will be included in generated JavaScript files.</p>
4547
<h2 id="examples">Examples</h2>
4648
<figure>
4749
<figcaption>A module that is distributed under the Apache License 2.0</figcaption><pre class="prettyprint lang-js"><code>/**
4850
* Utility functions for the foo package.
4951
* @module foo/util
5052
* @license Apache-2.0
5153
*/
54+
</code></pre>
55+
</figure>
56+
<figure>
57+
<figcaption>A standalone JSDoc comment with the complete MIT license</figcaption><pre class="prettyprint lang-js"><code>/**
58+
* @license
59+
* Copyright (c) 2015 Example Corporation Inc.
60+
*
61+
* Permission is hereby granted, free of charge, to any person obtaining a copy
62+
* of this software and associated documentation files (the "Software"), to deal
63+
* in the Software without restriction, including without limitation the rights
64+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
65+
* copies of the Software, and to permit persons to whom the Software is
66+
* furnished to do so, subject to the following conditions:
67+
*
68+
* The above copyright notice and this permission notice shall be included in all
69+
* copies or substantial portions of the Software.
70+
*
71+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
72+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
73+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
74+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
75+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
76+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
77+
* SOFTWARE.
78+
*/
5279
</code></pre>
5380
</figure>
5481
</article>

0 commit comments

Comments
 (0)