Skip to content

an example library #15

@scottnath

Description

@scottnath

@rebmullin @conortm @nikkiana @e2tha-e @sergesemashko @beynya

I have set up a library, which imports rebecca's pattern library as an example.

Library setup with imported library

My pattern library (PL) incorporates @rebmullin's pattern library, which is here:
https://github.com/rebmullin/rebecca-pattern-library

You can see the PatternLab instance from this library here:
http://scottnath.github.io/scottnath-pattern-library/

And where Rebecca's pattern was imported here:
http://scottnath.github.io/scottnath-pattern-library/?p=molecules-rebecca

The way I imported Rebecca's PL, was to run this statement:
npm install git+ssh://[email protected]:rebmullin/rebecca-pattern-library.git --save

Which:

  1. imported rebecca's PL into my local node_modules for scottnath-pattern-library
  2. added rebecca's PL into my package.json file (because the --save flag was added to the statement above)
...
  "dependencies": {
    "pattern-library": "^0.1.2",
    "rebeccaPatternLibrary-pattern-library": "git+ssh://[email protected]/rebmullin/rebecca-pattern-library.git"
  }
...

Then, I needed to add Rebecca's PL to my config file:

npmPatternRepos:
  -
    name: 'base' # short name for this library
    repoDir: 'pattern-library' # directory name for this library
# templates imported into pattern lab after it is installed by composer
  -
    name: 'rebecca' # short name for this library
    repoDir: 'rebeccaPatternLibrary-pattern-library' # directory name for this library
# templates imported into pattern lab after it is installed by composer

Odd directory name

Notice that the directory name above is rebeccaPatternLibrary-pattern-library. This is what comes from the second question when setting up a new pattern library with the generator:
"What is the name of the GitHub repository?"
you want this name to reflect the actual repo url.

Your response to this question eventually writes to your pattern library's package.json file. You can see that Rebecca's repo name is different in her package.json file:
https://github.com/rebmullin/rebecca-pattern-library/blob/master/package.json#L2
That name entry in the package.json file is what tells NPM how to name the imported package's directory.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions