You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: readme.md
+24-20Lines changed: 24 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ A front-end CLI for managing static design pattern libraries. Created and mainta
18
18
19
19
#### Background
20
20
21
-
This project started to make building and documenting accessible, CSS–first, and framework–free pattern libraries quick, easy, and fun, doing so without task runners and a minimal amount of JavaScript to tie it all together. It does this very well, and over time it has grown into a build system of its own, so acknowledging this as an in-house alternative is essential. Other pattern build systems with more extensive community support also exist and are well worth a look. These include [Storybook.js](https://storybook.js.org/), [Fractal](https://fractal.build/), [Pattern Lab](https://patternlab.io/), and possibly more.
21
+
The Patterns CLI is the core developer module of the [NYCO User Interface (UI) Patterns Framework](https://nycopportunity.github.io/patterns-framework/). The project started to make building and documenting accessible, CSS–first, and framework–free pattern libraries quick, easy, and fun, doing so without task runners and a minimal amount of JavaScript to tie it all together. It does this very well, and over time it has grown into a build system of its own, so acknowledging this as an in-house alternative is essential. Other pattern build systems with more extensive community support also exist and are well worth a look. These include [Storybook.js](https://storybook.js.org/), [Fractal](https://fractal.build/), [Pattern Lab](https://patternlab.io/), and possibly more.
22
22
23
23
## I want to
24
24
@@ -993,8 +993,6 @@ The basic pattern for commands is as follows:
993
993
$ {{ ENVIRONMENT_VARIABLE }}={{ value }} npx pttrn {{ command }} {{ flag }}
994
994
```
995
995
996
-
Every command is configured with one or a series of JavaScript files inside the [./config](config/) directory. The CLI will check to see if there is a custom configuration file in the local **./config** directory of the project first. If it doesn't exist it will use the [default configuration file in the CLI package](config/). Project configurations can be used to pass in additional and custom options to each package that the CLI uses. Below the packages used and default configurations are described in more detail.
997
-
998
996
-[`default`](#default)
999
997
-[`styles`](#styles)
1000
998
-[`tokens`](#tokens)
@@ -1010,9 +1008,17 @@ Every command is configured with one or a series of JavaScript files inside the
1010
1008
-[`serve`](#serve)
1011
1009
-[`publish`](#publish)
1012
1010
1011
+
### Command Configuration
1012
+
1013
+
Every command is configured with one or a series of JavaScript files inside the [./config](config/) directory. The CLI will check to see if there is a custom configuration file in the local **./config** directory of your project first. If it doesn't exist it will use the [default configuration file in the CLI package](config/). Project configurations can be used to pass in additional and custom options to each package that the CLI uses. Below the packages used and default configurations are described in more detail.
1014
+
1015
+
### Command Flags
1016
+
1013
1017
Optional [flags](#flags) can be passed to the commands for signaling watching and log settings. The log settings are universal so they aren't represented in the command tables below.
1014
1018
1015
-
[Custom commands](#custom-commands) have been newly introduced and are described below.
1019
+
### Commands
1020
+
1021
+
[Custom commands](#custom-commands) can be defined in the local project **./bin** are described below.
`default` or `` | `-w` | n/a | `production` or `development`
1024
1030
1025
-
Synchronously runs this series of commands; `styles`, `rollup`, `slm`, and `svgs` respectfully and described below.
1031
+
Uses [Concurrently](https://github.com/open-cli-tools/concurrently) to synchronously run this series of commands; [`styles`](#styles), [`rollup`](#rollup), [`slm`](#slm), and [`svgs`](#svgs), respectfully. Each command is described in more detail below. The series of commands can be modified by editing the array of commands defined in a custom [./config/default.js](config/default.js) file. Addionally, the options passed to [Concurrently](https://github.com/open-cli-tools/concurrently#concurrentlycommands-options) can also be
1026
1032
1027
1033
Back to [commands ^](#commands) | [table of contents ^](#contents)
`sass` | `-nl` | [sass.js](config/sass.js) | `production` or `development`
1064
1070
1065
1071
Uses [Dart Sass](https://github.com/sass/dart-sass) to compile Sass modules defined in the `sass` configuration into CSS. It will use [Node Sass](https://github.com/sass/node-sass) in place of Dart Sass if it is required in a project's **package.json** file. By default, it will compile the default Sass entry point [./src/scss/default.js](config/scaffold/default.scss). If `NODE_ENV` is set to `development` only the modules with the attribute `devModule: true` will be compiled.
@@ -1378,12 +1384,9 @@ $ npx pttrn custom
1378
1384
✨ My custom command
1379
1385
```
1380
1386
1381
-
Custom commands can use [other packages](https://www.npmjs.com/) that are not integrated in this project and reuse the CLI [scripts](bin/), [utilities](bin/util/), or [default configuration](config/). Custom commands can also be packaged, published, and shared between projects. Below are a few published custom command plugins.
[Patterns Plugin Feather](https://github.com/CityOfNewYork/patterns-plugin-feather) | Compile a [Feather icon](https://feathericons.com/) sprite from the Feather package into the dist directory.
1386
-
[Patterns Plugin Twig](https://github.com/CityOfNewYork/patterns-plugin-twig) | Will compile Twig view templates effectively replacing the default Slm compiler with [Twig.js](https://github.com/twigjs/twig.js/).
1389
+
Custom commands can use [other packages](https://www.npmjs.com/) that are not integrated in this project and reuse the CLI [scripts](bin/), [utilities](bin/util/), or [default configuration](config/) in different ways. Custom commands can also be packaged, published, and shared between projects as plugins. A few published [custom command plugins](#custom-command-plugins) are described below.
1387
1390
1388
1391
[Back to table of contents ^](#contents)
1389
1392
@@ -1472,7 +1475,7 @@ CSS utilities make it easier for developers who do not actively maintain your pa
1472
1475
The `scaffold` command creates a [./config/tailwindcss.js](config/tailwindcss.js). If not using the `scaffold` command, create your configuration file:
1473
1476
1474
1477
```shell
1475
-
$ touch config/taiwindcss.js
1478
+
touch config/taiwindcss.js
1476
1479
```
1477
1480
1478
1481
In the configuration file, you can import your **./config/tokens.js** configuration and include design tokens from your project in the Tailwindcss configuration. You may also use the default configuration if desired.
@@ -1512,7 +1515,7 @@ You may notice this does not include the `@tailwind base` tag which adds some ba
1512
1515
These directives can be added anywhere but we recommend keeping them in the **./src/utilites** directory. The `scaffold` command creates a module directory for these directives automatically: **./src/utilities/tailwindcss**. If not using the `scaffold` command the directory and stylesheet can be added with the following `make` command:
1513
1516
1514
1517
```shell
1515
-
$ npx pttrn make utility tailwindcss style
1518
+
npx pttrn make utility tailwindcss style
1516
1519
```
1517
1520
1518
1521
Below are sample contents of the stylesheet from the `scaffold` command. Copy and paste them into the stylesheet if using the `make` command above.
@@ -1672,7 +1675,7 @@ The CLI ships with several optional dependencies.
1672
1675
To omit these packages to keep your project lean, use the `--no-optional` flag when installing.
1673
1676
1674
1677
```shell
1675
-
$ npm install @nycopportunity/pttrn --no-optional
1678
+
npm install @nycopportunity/pttrn --no-optional
1676
1679
```
1677
1680
1678
1681
These dependencies are required by the default configuration or recommended npm scripts. If your project is relying on many of the Framework's default configurations or you want to model your project to closely resemble the original configuration then it is recommended to include them in your project.
@@ -1694,10 +1697,11 @@ Package | Descript
1694
1697
1695
1698
Refer to [custom commands](#custom-commands) on how to create plugins.
[Patterns Plugin Feather](https://github.com/CityOfNewYork/patterns-plugin-feather) | Compile a [Feather icon](https://feathericons.com/) sprite from the Feather package into the dist directory.
1700
-
[Patterns Plugin Twig](https://github.com/CityOfNewYork/patterns-plugin-twig) | Will compile Twig view templates effectively replacing the default Slm compiler with [Twig.js](https://github.com/twigjs/twig.js/).
[Patterns Plugin Feather](https://github.com/CityOfNewYork/patterns-plugin-feather) | Compile a [Feather icon](https://feathericons.com/) sprite from the Feather package into the dist directory.
1703
+
[Patterns Plugin Twig](https://github.com/CityOfNewYork/patterns-plugin-twig) | Will compile Twig view templates effectively replacing the default Slm compiler with [Twig.js](https://github.com/twigjs/twig.js/).
1704
+
[Patterns Plugin Properties](https://github.com/NYCOpportunity/patterns-plugin-properties) | Will compile JSON tokens into CSS Custom Properties using [css-vars-from-json](https://github.com/TimoBechtel/css-vars-from-json).
0 commit comments