1.19.6 • Published 2 years ago

@ithaka/bonsai v1.19.6

Weekly downloads
14
License
ISC
Repository
github
Last release
2 years ago

Bonsai

ITHAKA core styling and JavaScript functionality

Installation

$ npm install @ithaka/bonsai

Development

System Dependencies

This project requires Node.js and npm to be installed prior to development work.

Package Dependencies

Installing all necessary dependencies for building the package should be as simple as:

$ npm install

Building the package

Once you've installed all the dependencies, building the package can be accomplished with:

$ npm run build

To watch for changes:

$ npm run watch

To start a local development server with hot reloading:

$ npm run start  # or simply "npm start"

Testing

To run tests:

$ npm run test  # or simply "npm test"

Style Guide

The Bonsai Style Guide is dynamically generated using the zurb/supercollider library.

To contribute to the Bonsai documentation and style guide, you will want to run it locally.

Running Locally

You'll need node and git installed on your machine.

$ git clone https://github.com/ithaka/bonsai.git
$ cd bonsai
$ npm install # this could take a few minutes
$ npm run start

$ npm run start will launch the development server on http://localhost:8080. Navigate there and you will be redirected to the index of the style guide

Any time a file change is saved the documentation will recompile. Refresh the page to see your change.

Making a new page in the style guide

You might want to write the documentation in Markdown

Learn Markdown

Markdown Cheatsheet

Let's say that JSTOR is going to create a new feature giving esteemed researchers a plethora of new tools for their study of cats. Suddenly the style guide needs a page about cats! Here's how you'd make it.

Create a markdown file (cats.md) in documentation/pages/. At the very minimum it needs a title, description, and content.

documentation/pages/cats.md

---
title: Cats Cats Cats!
description: Guidelines for the JSTOR Cats feature set
---

<!-- here down can be a mix of HTML and Markdown -->

![](kitten.jpeg)

<div class="cat-container">
    <p class="cat">CAT</p>
</div>

The bulk of the content for each page can be markdown, html, or a mix of the two

If you want to dynamically include the sass or js documentation for the cats component, simply add it in the header of the markdown file. Both sass and js are optional.

---
title: Cats Cats Cats!
description: Guidelines for the JSTOR Cats feature set
sass: ./scss/_cats.scss
js: ./js/bonsai.cats.js
---

Additionally, supercollider allows the creation custom adapters if types of documentation other than html, sass, and js need to be dynamically generated.

HTML Examples

When documenting how to use a component, you may want to include example code. Giving the markdown block the language level of html_example will insert the rendered html directly after the markdown example.

For example this:

```html_example
<button>I am button</button>
```

will display the literal code, plus the rendered button afterwards.

Routing

After making the markdown file, but probably before you put all your content in there, you should add it to the routes. Go to documentation/routes/js, and add a line in the array that has the name of your markdown file.

routes.js before

module.exports = [
  "button",
  "modal"
]

routes.js after

module.exports = [
  "button",
  "modal",
  "cats"
]

By adding "cats" to this array, we enable hot reloading for the cats.md file as well as add an option for "Cats" in the navigation of the style guide

The Style Guide Build System

  • webpack
    • webpack-shell-plugin
    • raw-loader
  • supercollider
    • foundation-docs custom markdown interpreter
  • handlebars

What happens when running npm run start?

npm.io

  1. Webpack is run, processing all the files defined in the entry object in webpack.config.js
  2. Once all the files are processed, the WebpackShellPlugin runs node generate-docs.js
  3. generate-docs.js contains the SuperCollider configuration and initialization.
  4. SuperCollider generates the html by taking all the markdown templates, running them through the markdown interpreter, getting the sassDocs and jsDocs associated with each markdown file, and running them all through the primary handlebars template. This is then all output as raw html to documentation/styleguide/. These settings are all in the generate-docs.js file
  5. A development server is launched at localhost:8080

The development server is now watching the sass, javascript, markdown, and main template for changes. It does this because all these files are run through webpack (even though they're not all compiled)

In js/index.js the main handlebar template is imported, as well as an array of all the names of the individual components that are a part of the style guide. Iterating through the array, every markdown file is also imported into the js/index.js.

We don't tell webpack what to do with these files, but we do have to give webpack a loader for .html and .md files. There are rules setup to run html and md through the raw-loader. Now webpack is aware of everything, and anytime something it's aware of changes it runs through the above steps again, minus launching a duplicate server.

Publishing to NPM

Everything that gets merged into the develop branch will become a beta release

Everything that gets merged into the master branch will become a latest release.

Please note that each pull request that is being merged into either of these branches need to have an updated version in the package.json file so that the npm publish can succeed.

Jenkins jobs that automate these releases exist here: http://jenkins.test.cirrostratus.org:8080/job/build-bonsai-develop/ http://jenkins.test.cirrostratus.org:8080/job/build-bonsai-master/

1.23.2-beta.3

2 years ago

1.23.2-beta.1

2 years ago

1.23.2-beta.2

2 years ago

1.23.1

3 years ago

1.23.0-beta.0

3 years ago

1.23.0-beta.1

3 years ago

1.23.0

3 years ago

1.22.2

3 years ago

1.22.2-beta.0

3 years ago

1.22.1

3 years ago

1.22.1-beta.6

3 years ago

1.22.1-beta.4

3 years ago

1.22.1-beta.3

3 years ago

1.22.1-beta.2

3 years ago

1.22.1-beta.0

3 years ago

1.22.1-beta.1

3 years ago

1.22.0

3 years ago

1.22.0-beta.0

3 years ago

1.21.0

4 years ago

1.21.0-beta.1

4 years ago

1.21.0-beta.0

4 years ago

1.20.1

4 years ago

1.20.1-beta.0

4 years ago

1.20.0

4 years ago

1.20.0-beta.4

4 years ago

1.20.0-beta.3

4 years ago

1.20.0-beta.1

4 years ago

1.20.0-beta.0

4 years ago

1.19.7

4 years ago

1.19.7-beta.2

4 years ago

1.19.7-beta.0

4 years ago

1.19.6

4 years ago

1.19.6-beta.0

4 years ago

1.19.5

4 years ago

1.19.5-beta.0

4 years ago

1.19.4

4 years ago

1.19.4-beta.2

4 years ago

1.19.4-beta.1

4 years ago

1.19.4-beta.0

4 years ago

1.19.3

4 years ago

1.19.2

4 years ago

1.19.2-beta.1

4 years ago

1.19.2-beta.0

4 years ago

1.19.1

4 years ago

1.19.1-beta.0

4 years ago

1.19.0

4 years ago

1.19.0-beta.0

4 years ago

1.18.0

4 years ago

1.18.0-beta.1

4 years ago

1.18.0-beta.0

4 years ago

1.17.3

4 years ago

1.17.2

4 years ago

1.18.0-rc.1

4 years ago

1.18.0-rc.0

4 years ago

1.17.1

5 years ago

1.17.0

5 years ago

1.16.10

5 years ago

1.16.9

5 years ago

1.16.8

5 years ago

1.16.7

5 years ago

1.16.6

6 years ago

1.16.5

6 years ago

1.16.4

6 years ago

1.16.3

6 years ago

1.16.2

6 years ago

1.16.1

6 years ago

1.16.0

6 years ago

1.15.1

6 years ago

1.15.0

6 years ago

1.14.0

6 years ago

1.13.1

6 years ago

1.13.0

6 years ago

1.12.0

6 years ago

1.11.0

6 years ago

1.10.0

6 years ago

1.10.0-rc2

6 years ago

1.10.0-rc1

6 years ago

1.9.17

6 years ago

1.9.16

6 years ago

1.9.15

6 years ago

1.9.15-rc1

6 years ago

1.9.14

6 years ago

1.9.13

6 years ago

1.9.12

6 years ago

1.9.11

6 years ago

1.9.10

6 years ago

1.9.9

6 years ago

1.9.8

6 years ago

1.9.7

6 years ago

1.9.6

6 years ago

1.9.5

6 years ago

1.9.4

6 years ago

1.9.3

6 years ago

1.9.2

6 years ago

1.9.1

6 years ago

1.9.0

6 years ago

1.8.3

6 years ago

1.8.2

6 years ago

1.8.1

6 years ago

1.8.0

6 years ago

1.7.1

6 years ago

1.7.0

6 years ago

1.6.2

6 years ago

1.6.1

6 years ago

1.6.1-rc2

6 years ago

1.6.1-rc1

6 years ago

1.6.0

6 years ago

1.5.5

6 years ago

1.5.5-rc1

6 years ago

1.5.4

6 years ago

1.5.4-rc1

6 years ago

1.5.3

6 years ago

1.5.2

6 years ago

1.5.2-rc1

6 years ago

1.5.1

6 years ago

1.5.0

6 years ago

1.5.0-rc1

6 years ago

1.4.2

6 years ago

0.0.13

6 years ago

0.0.12

6 years ago

0.0.11

6 years ago

1.4.2-rc2

6 years ago

1.4.2-rc1

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago

1.4.1

6 years ago

1.4.1-rc1

6 years ago

1.4.0

6 years ago

1.2.9

6 years ago

1.3.0

6 years ago

1.3.0-rc3

7 years ago

1.3.0-rc2

7 years ago

1.2.5

7 years ago

1.2.5-rc1

7 years ago

1.2.4

7 years ago

1.2.4-rc2

7 years ago

1.3.0-rc1

7 years ago

1.2.3

7 years ago

1.2.3-rc3

7 years ago

1.2.3-rc2

7 years ago

1.2.3-rc1

7 years ago

1.2.2

7 years ago

1.2.2-rc1

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.1.0-rc1

7 years ago

1.0.0

7 years ago

1.0.0-rc10

7 years ago

1.0.0-rc9

7 years ago

1.0.0-rc8

7 years ago

1.0.0-rc7

7 years ago

1.0.0-rc6

7 years ago

1.0.0-rc5

7 years ago

1.0.0-rc4

7 years ago

1.0.0-rc3

7 years ago

1.0.0-rc2

7 years ago

1.0.0-rc1

7 years ago

0.3.0

7 years ago

0.2.0

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.0

7 years ago