docs/guides/CODEPEN.md
Users can click a button on each demo to open it in CodePen for editing. From there the user can edit, save, or make other modifications to the example.
CodePen appears to be one the most stable and active online sandboxes. It offers a more accessible experience compared to other tools.
Clicking 'Edit on CodePen' creates a new CodePen instance that includes all HTML, CSS, and JavaScript assets via the CodePen API. We append an additional script to the new CodePen to initialize the cache, which is responsible for serving assets.
ng-template. See docsWe store SVG images in an asset cache using $templateCache. We send a script to CodePen that
initializes the cache within the demo module.
Components within AngularJS Material, at times, use icons or SVG images. Images
fetched over HTTP, without having a server that will allow cross
site scripting (Access-Control-Allow-Origin: *), will fail with a
CORS error.
We use the asset cache to bypass HTTP requests for images by instead serving the cached content.
./scripts/build-asset-cache.sh | pbcopy to add an object literal to your paste buffer.var assetMap = { ... } in the svg-assets-cache.jsCDN is located on the CodePen PRO account.
svg-assets-cache.js file.svg-assets-cache.js file.
The step to generate and deploy the svg-assets-cache.js is currently a
manual process. Keep in mind, you need to follow the steps for building and
updating the asset cache on the CDN when making any changes to a SVG image used by
a demo or, the docs site.