Skip to content

Commit

Permalink
Merge pull request #188 from farmOS/docs-npm-usage
Browse files Browse the repository at this point in the history
Link to NPM section under Usage section in README.md.
  • Loading branch information
mstenta authored Nov 3, 2022
2 parents 5d37db7 + 9eba4ce commit 58ee947
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ farmOS Map is an [OpenLayers](https://openlayers.org/) map for farmOS.

For more information on farmOS, visit [farmOS.org](https://farmOS.org).

## Usage
## Installation

### Via HTML `<script>` Tag

1. Host the `.js` and `.css` files from the `dist/` directory of this package somehow.
2. Include `farmOS-map.js` and `farmOS-map.css` in the page. e.g.:
Expand All @@ -22,6 +24,18 @@ For more information on farmOS, visit [farmOS.org](https://farmOS.org).
4. Call the map creation method with the element ID: `farmOS.map.create('farm-map');`
5. (optional) Add behaviors - see below.

### Via Package Managers

farmOS-map can be installed via `npm-cli`, `yarn` or other package managers from the npm registry:

```sh
npm install @farmos.org/farmos-map@2
```

For additional configuration, see [Working with farmOS-map in an NPM/Webpack Project](#working-with-farmos-map-in-an-npmwebpack-project).

## Usage

### Creating a Map

The simplest way to create a map is to call the `create` method with an HTML
Expand Down Expand Up @@ -629,13 +643,8 @@ The farmOS-map accent color can be changed with the `--farmos-map-accent-color`
### Working with farmOS-map in an NPM/Webpack Project

Some integration scenarios require farmOS-map to be modeled as a dependency - i.e. so static analysis can
validate/document class/method references.

farmOS-map can be added via NPM or similar package managers. e.g.

```sh
npm install @farmos.org/farmos-map@2
```
validate/document class/method references. In these cases, installation is usually performed
[via a package manager](#via-package-managers) like `npm-cli` or `yarn`.

Then farmOS-map can be accessed using an `import` statement.

Expand Down

0 comments on commit 58ee947

Please sign in to comment.