Skip to content

Commit

Permalink
Move package under x-govuk organisation namespace on NPM
Browse files Browse the repository at this point in the history
  • Loading branch information
paulrobertlloyd committed Mar 8, 2023
1 parent 1d274f2 commit 0ad1080
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Node.js v16 or later.
## Installation

```shell
npm install govuk-prototype-components --save
npm install @x-govuk/govuk-prototype-components
```

## Usage with the GOV.UK Prototype Kit
Expand All @@ -46,13 +46,13 @@ If you are using an earlier version of the GOV.UK Prototype Kit, or only want to
To import all the Sass rules from GOV.UK Prototype Components, add the following to your Sass file:

```scss
@import "node_modules/govuk-prototype-components/x-govuk/all";
@import "node_modules/@x-govuk/govuk-prototype-components/x-govuk/all";
```

You can also import Sass rules for an individual component. For example, to import styles for the masthead component, add the following to your Sass file:

```scss
@import "node_modules/govuk-prototype-components/x-govuk/components/masthead/masthead";
@import "node_modules/@x-govuk/govuk-prototype-components/x-govuk/components/masthead/masthead";
```

### JavaScript
Expand All @@ -66,8 +66,8 @@ To import the JavaScript for the GOV.UK Prototype Components, you can either:

If you decide to add the JavaScript to your HTML, first either:

* set up your routing so that requests for the JavaScript file are served from `node_modules/govuk-prototype-components/x-govuk/all.js`
* copy the `node_modules/govuk-prototype-components/x-govuk/all.js` file into your application
* set up your routing so that requests for the JavaScript file are served from `node_modules/@x-govuk/govuk-prototype-components/x-govuk/all.js`
* copy the `node_modules/@x-govuk/govuk-prototype-components/x-govuk/all.js` file into your application

Then import the JavaScript file before the closing `</body>` tag of your HTML page or page template, and run the `initAll` function to initialise all the components.

Expand All @@ -86,15 +86,15 @@ Then import the JavaScript file before the closing `</body>` tag of your HTML pa
If you decide to import using a bundler, use `import` to import all GOV.UK Prototype Components, then run the `initAll` function to initialise them:

```js
import { initAll } from 'govuk-prototype-components'
import { initAll } from '@x-govuk/govuk-prototype-components'

initAll()
```

You can also import the JavaScript for an individual component. For example, to import the autocomplete component, add the following to your JavaScript file:

```js
import { Autocomplete } from 'govuk-prototype-components'
import { Autocomplete } from '@x-govuk/govuk-prototype-components'

const myAutocomplete = document.querySelector('#my-autocomplete')
new Autocomplete(myAutocomplete).init()
Expand All @@ -105,7 +105,7 @@ new Autocomplete(myAutocomplete).init()
If you’re using a bundler that uses CommonJS (like [Browserify](http://browserify.org/)), use `require`:

```js
const GOVUKPrototypeComponents = require('govuk-prototype-components')
const GOVUKPrototypeComponents = require('@x-govuk/govuk-prototype-components')

GOVUKPrototypeComponents.initAll()
```
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "govuk-prototype-components",
"name": "@x-govuk/govuk-prototype-components",
"version": "1.1.0",
"description": "Common and experimental components that are not yet part of the GOV.UK Design System",
"keywords": [
Expand Down

0 comments on commit 0ad1080

Please sign in to comment.