Skip to content

Instantly share code, notes, and snippets.

@tomasdev
Created June 6, 2017 15:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomasdev/0d4825e38e27985eda4819c3e0c0e674 to your computer and use it in GitHub Desktop.
Save tomasdev/0d4825e38e27985eda4819c3e0c0e674 to your computer and use it in GitHub Desktop.
Minimum HTML required for a Contentful extension
<!DOCTYPE html>
<html>
<head>
<!-- the following is optional -->
<link rel="stylesheet" type="text/css" href="https://unpkg.com/contentful-ui-extensions-sdk@2/dist/cf-extension.css">
</head>
<body>
<h1>Hello World</h1>
<script src="https://unpkg.com/contentful-ui-extensions-sdk@2"></script>
<script>
window.contentfulExtension.init(extension => {
extension.window.startAutoResizer();
let value = extension.field.getValue();
console.log('Value received', value);
// Call extension.field.setValue('new value'); whenever you want to update it
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment