Airship is divided into three main packages:
These three packages are what Airship provides to build your own location intelligence application.
Airship components are built on top of StencilJS, which allows us to provide lightweight and easy to use components.
You can find the components’ source code in src/components
folder. Each component has several files associated:
Airship components are always lazy loaded, so there is no need to worry about importing the whole bundle or each component separately.
By importing @carto/airship-components
package, the components loader will be included in your bundle and it will lazy-load components by injecting them as soon as they are present in the DOM.
Airship styles are split into several folders to allow importing the whole bundle or each style separately, aiming to give flexibility and the possibility to reduce the size of the application’s final bundle.
Styles are provided in two different flavours:
We follow the same directory scaffolding in both cases, whether they are SASS styles or CSS styles. The root directory for each flavour is:
@carto/airship-style/dist/{path}
@carto/airship-style/src/{path}
In case you want to import the whole bundle, you need to import:
import '@carto/airship-style';
@import '~@carto/airship-style';
If you want to include any of the styles separately, you need to look for the path and append it to the root directory folder. You can find all of them here.
All directories have a similar structure:
README.md
: a brief explanation of the component and its usage.Whenever you need to import any of those components, include the appropriate snippet in your code:
import '@carto/airship-style/src/{path}';
@import '~@carto/airship-style/src/{path}';
import '@carto/airship-style/dist/{path}';
@import '~@carto/airship-style/dist/{path}';
Assuming that you want to import badges component, these are the snippets you can choose from:
import '@carto/airship-style/src/badges/badges';
@import '~@carto/airship-style/src/badges/badges';
import '@carto/airship-style/dist/badges/badges';
@import '~@carto/airship-style/dist/badges/badges';
Airship includes a set of icons to place into your application. These icons can be found in this folder.
Each SVG is automatically generated from a path set in paths.js
.
Similarly to styles, we provide icons in two flavours:
<img>
tag.While SVG files are easier and lightweight to use, using the Web Font approach provides multiple possibilities for customization with CSS.
When including icons package in CSS or SASS via Webpack or another bundler, it will use Web Font by default. If you prefer to use each SVG file separately, you will need to reference the file via CDN or require the file from node_modules folder wherever you want.
Icons’ dist/
folder is the root content of the npm package. To include each icon separately you need to require the path starting from that folder, like this: @carto/airship-icons/icons/{icon_name}.svg
. Replacing {icon_name}
with the desired icon name.