Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
@amplience/dc-integration-stylitics
Advanced tools
Library of utilities to make using Amplience and Stylitics together simpler.
A library for managing Stylitics Widgets within modern web frameworks, configuring them with content items from Amplience, as well as a collection of Content Types and Schemas you can install to make integrating Stylitics with Amplience considerably easier.
Using the Stylitics integration library requires a simple import from NPM or linking a prebuilt js file.
Once imported, the following two methods can be used:
fromContentItem
: Convert from a content item containing Stylitics widget configuration into arguments you can provide to create the widget.createWidget
: Create a Stylitics widget with a given set of arguments, including view type and account. Automatically loads necessary scripts for the view type asynchronously, and keeps them loaded for future requests.These can be used regardless of implementation type (NodeJS project, Simple HTML/JS/CSS project or even using the Amplience Content Rendering Service)
The examples below show how you would use in each implementation type. We would recommend using the Amplience DC Delivery SDK to fetch your content
Install the package from NPM:
npm i @amplience/dc-integration-stylitics
You can use it in your project as follows:
import { fromContentItem, createWidget } from '@amplience/dc-integration-stylitics';
// Fetch from DC, in the format found in the automation.
const contentItem = {
...
}
const element = document.getElementById('widget');
const args = fromContentItem(contentItem);
const widget = await createWidget(element, args);
widget.start();
Similar to using the Stylitics widget manually, you can set overrides before starting the widget, refresh it with new arguments, or destroy()
it when finished.
For projects that don't use node, you can import a pre-packaged script that places the module in the global scope as ampStylitics
:
<script src="https://unpkg.com/@amplience/dc-integration-stylitics/dist/ampStylitics.browser.umd.min.js"></script>
<div id="widget"></div>
<script>
// Fetch from DC, in the format found in the automation.
const contentItem = {
...
}
const element = document.getElementById('widget');
const args = ampStylitics.fromContentItem(contentItem);
ampStylitics.createWidget(element, args).then(
widget => widget.start()
);
</script>
In the /examples
folder you will see an implementation with the following files that includes fetching an item, instantiating the widget and support for real-time visualisation:
HTML Example: examples/stylitics-generic-html.html
JavaScript used to fetch content / visualisation: examples/stylitics-widget.js
FAQs
Library of utilities to make using Amplience and Stylitics together simpler.
We found that @amplience/dc-integration-stylitics demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 12 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.