https://github.com/openlayers/create-ol-app
Set up a new OpenLayers based application
https://github.com/openlayers/create-ol-app
Last synced: 8 months ago
JSON representation
Set up a new OpenLayers based application
- Host: GitHub
- URL: https://github.com/openlayers/create-ol-app
- Owner: openlayers
- Created: 2021-06-24T16:17:00.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-11-01T03:22:19.000Z (about 1 year ago)
- Last Synced: 2024-11-01T04:16:32.909Z (about 1 year ago)
- Language: JavaScript
- Size: 173 KB
- Stars: 24
- Watchers: 4
- Forks: 5
- Open Issues: 3
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# create-ol-app
The `create-ol-app` program sets up a project directory with the dependencies required for developing an OpenLayers application. The program requires `npx`, distributed with [Node](https://nodejs.org/) (at least version 12), and [`git`](https://github.com/git-guides/install-git).
Using `create-ol-app` saves you from having to set up or configure tools like Vite, webpack, or Parcel. After setting up a new OpenLayers application, you can proceed with configuring the development environment to your liking βΒ the `create-ol-app` program sets up the required tools, but doesn't lock you in to any specific configuration.
## Creating a new application
To create a new OpenLayers application, choose a name for your application (`my-app` below) and run the following:
npx create-ol-app my-app
*π If you get an error like "could not find commit hash" when running `create-ol-app`, make sure that you have [`git` installed](https://github.com/git-guides/install-git)*.
This will create a new directory called `my-app` (choose a different name if you like) and install the dependencies for OpenLayers application development. By default, [Vite](https://vitejs.dev/) is used for development and bundling. See below for other options.
*π‘ Tip β if you run `npx create-ol-app` with no additional arguments, the new application will be set up in the current directory.*
After the step above completes, you can change into your new application directory and start a development server:
cd my-app
npm start
See the `my-app/readme.md` for more detail on working with the new application.
### Choosing a bundler
The `create-ol-app` program supports a few different module bundlers. By default, an application is set up using [Vite](https://vitejs.dev/). To use a different bundler, pass the `--template` option to `create-ol-app`.
The default template uses Vite. This is equivalent to running the following:
npx create-ol-app my-app --template vite
To see what other templates are available, see the help output for the `create-ol-app` program:
npx create-ol-app --help
To use webpack instead of Vite, run the following:
npx create-ol-app my-app --template webpack
After creating a new application, see the included `readme.md` for more details on getting started.