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

sdc-site-tiles

v2.1.1

Published

A versatile module for displaying news stories and other media in predefined grids.

Downloads

2

Readme

SDC Site Tiles

A versatile module for displaying news stories and other media in predefined grids.

This project uses the Toolbelt as the build tool.

For help using the tool, see the Toolbelt project repository or run toolbelt --help once installed.

Contents

Toolbelt

Preview

To build the html, css and javascript and preview the component:

toolbelt preview Points at data.json

toolbelt preview --multiple Points at multiple.json

Testing

To test the component scripts, run this command:

toolbelt test

Linting

To lint the component scripts, run this command:

toolbelt lint

Example data

Is available in /sample/data.json

Variants

Variants are alternative layouts for a grid of media items. Each grid of items can have one optional variant to allow the layout of the grid to be altered using CSS.

{
  "variant": 'alt2',
  "items": []
}

results in:

<div class="sdc-site-tiles sdc-site-tiles--alt2">

The following variants are currently available:

| variant | description | |---|---| | alt1 | 2 cols per row at tablet and desktop | | alt2 | alternates between 3 and 2 cols at desktop | | alt3 | alternates between 2 and 3 cols at desktop |

Items

Each item in the grid can optionally accept both a modifier and a template reference. A template reference can be used to point to another named handlebars template if the consumer wishes to display a different item type in the grid:

{
  "template": 'my-template'
  "modifier": null
}

The modifier can also be added to each item to alter its display characteristic using CSS. The following modifiers are available:

| modifier | description | |---|---| | hero-horizontal | Uses a full width horizontal layout at desktop | | hero-horizontal-tablet | Uses a full width horizontal layout at tablet |

Default item

If no template is set in an item object, a default is used. The default is a standard media item with an image, headline title and link:

{
  "template": null,
  "modifier": null,
  "type": {
    "video": true
  },
  "dateTime": "7 Feb",
  "tag": "Football",
  "title": "Champions League draw LIVE!",
  "listingImage": {
    "type": "image",
    "template": "http://uat.e.365dm.com/16/08/{width}x{height}/sergio-aguero-aguero-man-city-aguero-scores_3766300_3424114.jpg?20160818004905",
    "alt": "Manchester City's Argentinian striker Sergio Aguero",
    "caption": "Manchester City's Argentinian striker Sergio Aguero",
    "src": "http://uat.e.365dm.com/16/08/206x155/sergio-aguero-aguero-man-city-aguero-scores_3766300_3424114.jpg?20160818004905",
    "aspectRatio": "4/3",
    "dimensions": []
  },
  "link": "/",
  "related": null
}

Standard grid

In the default desktop view, the grid component defaults to a grid of 3 columns:

[1][2][3]
[4][5][6]

At tablet this breaks down to 2 columns:

[1][2]
[3][4]
[5][6]

At mobile this breaks down to a single column:

[1]
[2]
[3]
[4]
[5]
[6]

The same number of items is displayed at all breakpoints.

Fallbacks

If there are less than 3 items in the grid, it will fall back to the following layouts ([-] represents an empty slot):

1 item

Desktop:

[1][-]

Tablet

[1][-]

Mobile

[1]

2 items

Desktop:

[1][2]

Tablet

[1][2]

Mobile

[1]
[2]

Breakpoints

| desktop | tablet | mobile | |:---:|:---:|:---:| | >860px | 600-860px | <600px |

Global flags

Some flags are available in the root of the data that change attributes of the entire grid of tiles.

| flag | values | description | |:---|:---|:---| | hideTags | true/false | Does not output the html for a tag regardless of whether a tag is available in the data | | lazyImages | true/false | Sets the image markup in tags to use data-srcset instead if srcset for compatibility with bespoke js lazy loading scripts (used on skysports.com)