Skip to content

Commit

Permalink
docs(api): add cdn script tag to docs api page and package pages (#336)
Browse files Browse the repository at this point in the history
  • Loading branch information
COV-GIS authored and jgravois committed Sep 24, 2018
1 parent 72c3b05 commit 47bdb8d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
6 changes: 6 additions & 0 deletions docs/acetate.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,12 @@ module.exports = function(acetate) {
}@${package.version}/dist/umd/${package.name.replace("@esri/arcgis-rest-", "")}.umd`;
});

// <code> friendly script tag string
// future entry point for adding SRI hash
acetate.helper("scriptTag", function(context, package) {
return `&lt;script src="https://unpkg.com/${package.name}@${package.version}/dist/umd/${package.name.replace("@esri/arcgis-rest-", "")}.umd.min.js"&gt;&lt;/script&gt;`;
});

acetate.helper("npmInstallCmd", function(context, package) {
const peers = package.peerDependencies
? Object.keys(package.peerDependencies).map(
Expand Down
4 changes: 2 additions & 2 deletions docs/src/api/_package.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ <h1 class="{{icon}} font-size-3 trailer-half"> {% link baseUrl + url, pkg.name,
<p class="trailer-half">{{pkg.description}}</p>
<h2 class="font-size--1 trailer-half">npm install:</h2>
<pre><code>{% npmInstallCmd pkg %}</code></pre>
<h2 class="font-size--1 trailer-half">CDN url:</h2>
<pre><code>{% cdnUrl pkg %}.js</code></pre>
<h2 class="font-size--1 trailer-half">CDN:</h2>
<pre><code>{% scriptTag pkg %}</code></pre>
<hr class="leader-half trailer-half">
<ul class="list-plain package-contents">
{% for declaration in declarations %}
Expand Down
6 changes: 3 additions & 3 deletions docs/src/api/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ <h1 class="font-size-4">Packages</h1>
<small class="label right">Version {{package.pkg.version}}</small>
<h2 class="{{package.icon}} font-size-3 trailer-half"> {% link baseUrl + package.pageUrl, package.pkg.name, class="tsd-kind-icon" %}</h2>
<p>{{package.pkg.description}}</p>
<h3 class="font-size--1 trailer-half">npm install:</h2>
<h3 class="font-size--1 trailer-half">npm install:</h3>
<pre><code>{% npmInstallCmd package.pkg %}</code></pre>
<h3 class="font-size--1 trailer-half">CDN url:</h2>
<pre><code>{% cdnUrl package.pkg %}.js</code></pre>
<h3 class="font-size--1 trailer-half">CDN:</h3>
<pre><code>{% scriptTag package.pkg %}</code></pre>
<hr class="leader-half trailer-half">
<ul class="list-plain package-contents">
{% for declaration in package.declarations %}
Expand Down

0 comments on commit 47bdb8d

Please sign in to comment.