NPM Install | CDN | Download | Usage

NPM Install

$ npm install @nycopportunity/access-patterns


Compiled styles and scripts in the /dist folder of the GitHub repository can be imported on the page using a CDN such as JsDelivr. The following global stylesheet link can be copied and pasted into the the <head> of your html document.

<link href="" rel="stylesheet">

The following global script source can copied and pasted before the closing </body> tag of your html document.

<script src=""></script>

With the script integrated, SVG icons can be added with the following snippet.

  var patterns = new AccessNyc();


The following url is the base url for all distributed files available via a CDN.

Visit the GitHub repository to browse all available files. All Patterns are distributed with their own styles and script dependencies in the /dist folder. For example, all of the “Accordion” dependencies would live in the /dist/components/accordion folder.

There are regular releases to the patterns which follow semantic versioning. You can keep up-to-date with new releases on each repository’s releases page.


You may also download an archive of the repository to include in your project; Download



Sass stylesheets for any pattern can be imported into a project from the source directory.

@import '@nycopportunity/access-patterns/src/components/accordion/accordion';


The majority of patterns share the same filename for the Sass and JavaScript (if a pattern uses JavaScript). It may be necessary to specify that you need to import the Sass file for React (or other) applications.

@import '@nycopportunity/access-patterns/src/components/accordion/_accordion.scss';


Importing tailwindcss is an exception because it is compiled to a Sass file in the dist directory…

@import 'node_modules/@nycopportunity/access-patterns/dist/styles/_tailwindcss.scss';

… and a CSS file in the distribution folder:

<link href="" rel="stylesheet">

Asset Paths and CDN

The styles use the url() for loading webfonts, images, and svgs. By default, it is set to look for asset directories one directory up from the distributed stylesheet so the directory structure of your application is expected to look like so:


However, you can set the path to a different path that includes all of these files using the $cdn variable.

// $cdn: '../'; (default)
$cdn: 'path/to/assets/';

This variable should be placed above all of your imports of the pattern Sass files. The CDN can be set to another local path (such as an absolute path), or, it can be set to the remote url within the $tokens map.

This default uses jsDelivr to pull the assets from the patterns GitHub repository and the tag of the installed version. ex;

@import 'config/tokens';
$cdn: map-get($tokens, 'cdn');

These are the default paths to the different asset types within the asset folder. Uncomment and set to override their defaults.

$path-to-fonts: 'fonts/';
$path-to-images: 'images/';
$path-to-svg: 'svg/';

This is recommended for Webpack projects using the css-loader because Webpack will try to import the asset into your distributed stylesheet. If you don’t want to change the $cdn variable it is recommended for to disable the url / image-set functions handling with a boolean.

Resolving Paths to Patterns

You can add the string 'node_modules/@nycopportunity/access-patterns/src' to your “resolve” or “include” paths which will allow you to write the shorthand path;

@import 'components/accordion/accordion';


@import 'components/accordion/_accordion.scss';

For example; the node-sass includePaths option which is array of paths that attempt to resolve your @import declarations.

    file: './src/scss/default.scss',
    outFile: 'site-default.css',
    includePaths: [
  }, (err, result) => {
    Fs.writeFile(`./dist/styles/default.css`, result.css);

Similar to the the gulp-sass includePaths option.

gulp.task('sass', () => {
  return gulp.src('./sass/**/*.scss')
    .pipe(sass.({includePaths: [

Webpack can be configured with the resolve > modules option.

module.exports = {
  resolve: {
    modules: [


The JavaScript source is written as ES Modules, and using Rollup.js, individual components with JavaScript dependencies are distributed as IFFE functions. Depending on your project, you can import either of these. Below are examples of importing only the accordion component and initializing it.

ES Module Import

import Accordion from 'src/components/accordion/accordion';

new Accordion();


<script src="dist/components/accordion.iffe.js"></script>

<script type="text/javascript">
  new Accordion();

Note You can also use IFFE modules through the CDN installation method without needing using NPM to install in your project.

Global Pattern Script

You may also import the main patterns script with all of the dependencies in it. This script is exported as an IFFE function so it doesn’t need to be compiled but you may want to uglify it. Components must be initialized individually.

<script src="/dist/scripts/access-nyc.js"></script>

<script type="text/javascript">
  var patterns = new AccessNyc();


The main JavaScript import file in the source will show how each component needs to be initialized if it isn’t specified in the pattern’s documentation.

The Patterns include a polyfill bundle dist/scripts/polyfill.js using MDN Matches, MDN Closest, MDN Remove, whatwg-fetch and features from the Core JS Standard Libary (a dependency of @babel/preset-env). However, because this bundle includes all required polyfills so it is recommended to build your own polyfill based on your browser coverage requirements.

The ACCESS NYC Patterns are built using the NYCO Patterns Framework; a front-end stack, CLI, and cross-utility library for design systems. These installation instructions are automatically generated by the framework. For more details about the framework visit the GitHub repository.