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

@scottish-government/mygov-assets

v1.0.135

Published

Shared static components for Scottish public sector websites

Downloads

81

Readme

MyGov Assets

The MyGov Assets repository provides static web assets for websites and web applications for the Scottish Government and other Scottish public sector bodies.

More detailed documentation and usage notes for individual pieces of MyGov Assets can be found in the docs folder.

Building

Source Sass files can be found in the scss folder along with a sample "main" SCSS file, mygov-assets.scss, that you can use as a base for your own site's CSS.

To download dependencies required to build this project:

Run npm install. This will install dependencies into the node_modules directory.

To build CSS files from the Sass sources:

Compile mygov-assets.scss using a Sass compiler.

We have provided a Compass config file if Compass is your tool of choice. Run compass compile from the mygov-assets directory to compile mygov-assets.scss.

Anatomy of MyGov Assets

mygov-assets.scss is broken up into a few important pieces: grid, core, form elements, components, and trumps.

Grid

MyGov currently uses CSSWizardry Grids for its grid system. Its syntax is slightly fiddly since you need to eliminate whitespace between grid elements. See CSSWizardry Grids on GitHub for implementation notes.

Regardless of the grid system you use, in the vast majority of cases you should use additional elements for your grid structure. This keeps your pages' layout and content separate, helping flexibility and maintainability.

A trivial example

You do not want this:

<div class="grid"><!--
  --><h1 class="grid__item tablet--nine-twelfths">A title</h1><!--
  --><form class="grid__item tablet--three-twelfths">
      {{ form content }}
  </form><!--
--></div>

You do want this:

<div class="grid"><!--
    --><div class="grid__item tablet--nine-twelfths">
        <h1>A title</h1>
    </div><!--
    --><div class="grid__item tablet--three-twelfths">
        <form>
            {{ form content }}
        </form>
    </div><!--
--></div>

In the second example the content (the form and the h1) is not in any way tied to the grid and can be freely moved.

Core

MyGov Assets core contains styles that are required for correct display of all of the MyGov Assets components. Everything else in MyGov Assets is optional depending on your project's requirements, but you should always include _core.scss.

Form elements

MyGov Assets form elements contains styling for form-related elements. You should include _form-elements.scss if your project uses forms in any way.

Components

MyGov Assets components are discrete pieces of SCSS required for the display of particular components of a site, such as styling for multi-page navigation or search results. Include all of them or pick and choose the ones that you need.

Trumps

MyGov Assets trumps provide overrides for styles defined in component files where a more specific implementation of a component is desired. They typically extend or augment an existing component.

Style and conventions

  • Organise CSS/SCSS code in ITCSS format
  • CSS/SCSS follows BEM