npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mda-assets-template

v1.0.12

Published

Assets for MDA custom templates

Downloads

25

Readme

Custom templates in Multiverse Dynamics ADS

This package was created to provide the necessary assets in order to load the products from MDA into a custom HTML template.

Getting started

In order to get and show the products correctly from MDA, you need to follow this steps:

1. Load in your HTML

CDN (Recommended)

<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/mda-assets-template/dist/mda.js"></script>

Download

https://cdn.jsdelivr.net/npm/mda-assets-template/dist/mda.js

2. Initialize

Initialize MDA in your script file or at the end of <body>:

<script>
  document.addEventListener("DOMContentLoaded", function() {
    MDA({
      productsContainer: 'products',
      notAvailableMessageContainer: 'notAvailableMessage',
      sample: true,
    });
  });
</script>

Options

| Option | Value | Required | Default | Description | |------------------------------|---------|----------|---------------------|-------------------------------------------------------------------------------------------------| | productsContainer | string | yes | products | ID of the products container. The products will be loaded here. | | notAvailableMessageContainer | string | yes | notAvailableMessage | ID of the not available message. It will be shown if something went wrong loading the banner. | | mainContainer | string | no | container | ID of the main container. Only used to set the size as a class. Helpful for responsiveness. | | token | string | no | | Banner ID to identify the campaign. Use it when you want to test for a specific campaign | | loadingContainer | string | no | loading | ID of the loading container. It will be shown when the products are loading. | | size | string | no | 300x600 | Indicates the size of the banner. This size will be set as a class in the main container. | | sample | boolean | no | false | Indicates whether it loads sample products or real products. Useful when designing template. | | products | number | no | 4 | Only use if sample option is true. Indicates how many products you want to load in your sample. |

Optional CSS

You can add this CSS to get a ready-to-use style in your product list view:

CDN (Recommended)

<link href="https://cdn.jsdelivr.net/npm/mda-assets-template/dist/mda-theme.css" rel="stylesheet">

Download

https://cdn.jsdelivr.net/npm/mda-assets-template/dist/mda-theme.css

Styling

If you want to style the product list, this is the generated HTML for every product:

<!-- Class 'alert-stock' is only shown if this product has low stock or it could not be checked -->
<div class="product alert-stock">
  <!-- Product image-->
  <div class="image"></div>
  <!-- This img element is only loaded if you choose to show the store logo. The variable 'store-name' is set with the store name.  -->
  <img class="imageStore {store-name}">
  <!-- Container with name and price / button -->
  <div class="info">
    <!-- Product name -->
    <div class="name">{product-name}</div>
    <!-- Class 'price' if you choose to show the price, or class 'buyBtn' if you choose to show a button with the message 'Comprar' -->
    <div class="price | buyBtn">
      $25.000 | Comprar
    </div>
  </div>
</div>

Build

Install packages

npm install

Development

npm run dev

Compiles and minifies for production

npm run build