2.69.1 • Published 3 months ago

@gbg/gbgcomponentlibrary v2.69.1

Weekly downloads
352
License
ISC
Repository
-
Last release
3 months ago

Usage

Contibuting

Using the system

A component library is only as good as the projects that consume it.

npm i @gbg/gbgcomponentlibrary --save

Once thats installed you should include the CSS (node_modules/gbgdesignsystem/dist/bundle.js) and JS (node_modules/gbgdesignsystem/dist/bundle.js) bundles in your project.

Standard Web Projects

For standard web projects this can be done like so (after copying gbgdesignsystem to your document root):

<html>
  <head>
    ...

    <link
      href="gbgdesignsystem/dist/gbgcomponentlibrary.css"
      rel="stylesheet"
    />
  </head>
  <body>
    ...

    <script src="gbgdesignsystem/dist/gbgcomponentlibrary.js"></script>
  </body>
</html>

SCSS Based Projects

Projects using an SCSS pre-processor can consume the SCSS directly. This is done by setting the the relative directory of GBG component assets in a SCSS variable $gbg-component-asset-path before using the main.scss file. Doing this will make all scss variables available in your scss files. Setting a scss variable is necessary because SASS implementations do not provide url rewriting https://github.com/sass/libsass/issues/532

$gbg-component-asset-path: '../node_modules/@gbg/gbgcomponentlibrary/dist/src/assets';
@import '@gbg/gbgcomponentlibrary/dist/src/main.scss';

...

React Projects

We have a specific library for react based projects.

The library is a thin wrapper around this library, allowing for easier consumption in react projects.

Angular Projects

In an Angular project this can be achieved by adding the resources to your angular.json file like so:

{
    "projects": {
        "your-project": {
            "architect": {
                "build": {
                    "options": {
                        "styles": [
                            ...,
                            "./node_modules/gbgdesignsystem/dist/gbgcomponentlibrary.css"
                        ],
                        "scripts": [
                            ...,
                            "./node_modules/gbgdesignsystem/dist/gbgcomponentlibrary.js"
                        ]
                    }
                }
            }
        }
    }
}

Contibuting

Getting set up

make sure your node & npm installations are up to date! (node version 14.0.0 runs best)

Then in the project root:

npm install

And your done!

Editing

Now to work on the project run:

npm run storybook

This will launch storybook and start watching for changes.

finally run

npm run build

to build a final product, done!

Auto Documenting

Each of the html files containing a component also contains a syntax highlighted code sample for that component. This allows us to use saas documenting tools like zeroheight, to display storybook pages, and avoid having to manually update code samples.

To enable auto documenting of a section of code in a html file, wrap that code in comments like this:

<!--CODESAMPLE_BEGIN: A_KEY-->
...YOUR CODE...
<!--CODESAMPLE_END: A_KEY-->

Where A_KEY is replaced by a unique to the page key for that sample.

Then add a place for that sample to be written out, like this:

<!--CODESAMPLE: A_KEY-->
<pre class="code-sample" CODESAMPLE="A_KEY"><code class="language-html"></code><pre>

The comment line is important here. Now whenever the project is built the contents of the code block will be filled with an encoded version of the script, and the documentation will always stay up to date!

Code Syntax Highlighting

The syntax highlighting that can be seen in the code samples component is provided by the prismjs script, this is a superlightweight script that allows for highlighting on a ton of languages.

The plugin babel-plugin-prismjs is used by the webpack config to configure the prism build, and only include those features that we want, keeping the build size down to a minimum.

Adding a language or plugin

New languages or prism plugins can be added to the build by adding importing them in the ./src/index.ts file.

Releasing a new version

We follow a pull request pattern for contributions. All contributions should be in their own feature branch.

Before performing the realease steps, ensure all your changes are committed!

To release a version, and tag it, use the command:

npm run release

This will prompt you to select the type of version bump, bump the version number, create a git commit, tag that commit and push it, done!

FYI: The above command only commits the package.json file (and the lock file) all other changes must be committed first before running this command.

You should then open a new pull request for your changes, this will be reviewed and any required changes will be highlighted. If your changes are accepted they will be merged to the master branch and your new version will be built and published.

2.69.1

3 months ago

2.65.3

9 months ago

2.69.0

6 months ago

2.65.4

9 months ago

2.64.0

10 months ago

2.68.0

8 months ago

2.68.1

8 months ago

2.68.2

8 months ago

2.68.3

8 months ago

2.67.0

9 months ago

2.66.0

9 months ago

2.65.0

10 months ago

2.65.1

10 months ago

2.65.2

10 months ago

2.63.0

11 months ago

2.60.0

12 months ago

2.62.0

12 months ago

2.62.1

12 months ago

2.61.0

12 months ago

2.59.0

1 year ago

2.57.0

1 year ago

2.58.0

1 year ago

2.56.1

1 year ago

2.56.0

1 year ago

2.55.1

1 year ago

2.54.0-beta.1

2 years ago

2.55.2

1 year ago

2.55.3

1 year ago

2.54.0

2 years ago

2.53.0

2 years ago

2.52.0

2 years ago

2.51.0

2 years ago

2.49.0

2 years ago

2.48.0

2 years ago

2.47.0

2 years ago

2.47.1

2 years ago

2.50.1

2 years ago

2.46.9

2 years ago

2.46.8

2 years ago

2.46.5

2 years ago

2.46.4

2 years ago

2.46.7

2 years ago

2.46.1

2 years ago

2.46.0

2 years ago

2.46.3

2 years ago

2.46.2

2 years ago

2.46.14

2 years ago

2.46.12

2 years ago

2.46.11

2 years ago

2.46.18

2 years ago

2.46.17

2 years ago

2.46.16

2 years ago

2.46.15

2 years ago

2.46.10

2 years ago

2.45.0

2 years ago

2.44.1

2 years ago

2.44.0

2 years ago

2.43.0

2 years ago

2.43.2

2 years ago

2.43.1

2 years ago

2.43.4

2 years ago

2.42.5

2 years ago

2.42.4

2 years ago

2.41.1

2 years ago

2.42.1

2 years ago

2.42.0

2 years ago

2.42.3

2 years ago

2.42.2

2 years ago

2.38.0

3 years ago

2.41.0

2 years ago

2.39.0

2 years ago

2.40.0

2 years ago

2.37.0

3 years ago

2.36.2

3 years ago

2.36.1

3 years ago

2.36.0

3 years ago

2.35.1

3 years ago

2.35.2

3 years ago

2.35.0

3 years ago

2.33.1

3 years ago

2.33.0

3 years ago

2.32.3

3 years ago

2.32.2

3 years ago

2.32.1

3 years ago

2.32.0

3 years ago

2.31.1

3 years ago

2.31.2

3 years ago

2.29.0

3 years ago

2.29.2

3 years ago

2.29.1

3 years ago

2.27.0

3 years ago

2.30.2

3 years ago

2.30.1

3 years ago

2.30.4

3 years ago

2.30.3

3 years ago

2.30.5

3 years ago

2.28.0

3 years ago

2.26.4

3 years ago

2.31.0

3 years ago

2.26.3

3 years ago

2.26.2

3 years ago

2.26.1

3 years ago

2.26.0

3 years ago

2.25.1

3 years ago

2.25.0

3 years ago

2.24.3

3 years ago

2.24.2

3 years ago

2.24.1

3 years ago

2.24.0

3 years ago

2.23.0

3 years ago

2.22.0

3 years ago

2.21.1

3 years ago

2.21.0

3 years ago

2.20.2

3 years ago

2.20.1

3 years ago

2.20.0

3 years ago

2.19.0

3 years ago

2.18.8

3 years ago

2.18.7

3 years ago

2.18.6

3 years ago

2.18.5

3 years ago

2.18.3

3 years ago

2.18.4

3 years ago

2.18.2

3 years ago

2.18.1

3 years ago

2.18.0

3 years ago

2.17.0

3 years ago

2.16.2

3 years ago

2.16.1

4 years ago

2.15.0

4 years ago

2.16.0

4 years ago

2.14.2-beta.1

4 years ago

2.14.1-beta.1

4 years ago

2.14.0-beta.1

4 years ago

2.13.2-beta.1

4 years ago

2.13.1-beta.1

4 years ago

2.13.0-beta.1

4 years ago

2.12.2-beta.1

4 years ago

2.12.1-beta.1

4 years ago

2.12.0-beta.1

4 years ago

2.11.0-beta.1

4 years ago

2.10.0-beta.1

4 years ago

2.9.0-beta.1

4 years ago

2.8.0-beta.1

4 years ago

2.7.0-beta.1

4 years ago

2.6.1-beta.1

4 years ago

2.6.0-beta.1

4 years ago

2.5.0-beta.1

4 years ago

2.4.0-beta.1

4 years ago

2.3.0-beta.1

4 years ago

2.2.0-beta.1

4 years ago

2.1.1-beta.1

4 years ago

2.1.0-beta.1

4 years ago

2.0.2-beta.1

4 years ago

2.0.1-beta.1

4 years ago