Socket
Socket
Sign inDemoInstall

@geoscene/core

Package Overview
Dependencies
Maintainers
2
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@geoscene/core

GeoScene API for JavaScript: A complete 2D and 3D mapping and data visualization API


Version published
Maintainers
2
Created
Source

@geoscene /core

ES 模块的缩小的、未构建的版本 GeoScene API for JavaScript

特性

您可以通过 npm 安装这些模块,然后在 ReactVue.jsAngular 等框架中直接使用它们。或者,您也可以使用 Webpackrollup.js 创建自己的自定义构建。

开始

将模块安装到您的项目中:

npm install @geoscene/core

配置 CSS

将 CSS 设置为与已安装的 API 模块相同的版本。 您可以通过运行验证已安装的 API 版本 npm list @geoscene/core 。 如果你正在使用本地版本的 assets,查看 管理本地 assets 部分。

示例显示为生产 API 版本导入 CSS 4.24.0:

index.css

@import "https://js.geoscene.cn/4.24/@geoscene/core/assets/geoscene/themes/light/main.css";

配置 assets

对于大多数本地构建,API 的资产在运行时自动从 CDN 中提取,无需额外配置。 这些资产包括样式、图像、网络工作者、wasm 和本地化文件。

管理本地 assets

如果您需要在本地管理 assets,请将它们从 /node_modules/@geoscene/core/assets 复制到您的项目中,然后设置 config.assetsPath 以确保正确解析资产请求。 实现此目的的一种简单方法是配置在构建过程中运行的 npm 脚本。 例如,使用 npm 安装 ncp 并在 package.json 中配置一个脚本来复制该文件夹。

React 示例:

package.json

{
  "scripts": {
    "start": "ncp ./node_modules/@geoscene/core/assets ./public/assets && react-scripts start",
    "build": "ncp ./node_modules/@geoscene/core/assets ./public/assets && react-scripts build",
  }
}

App.js

import geosceneConfig from "@geoscene/core/config.js";
geosceneConfig.assetsPath = "./assets"; 

index.css

@import "@geoscene/core/assets/geoscene/themes/light/main.css";

对于 Angular,通过配置 angular.jsonarchitect/build/options/assets 部分来复制资产文件,例如:

angular.json

{
  "assets": [
    {
      "glob": "**/*",
      "input": "node_modules/@geoscene/core/assets",
      "output": "/assets/"
    }
  ]
}

app.component.ts

import geosceneConfig from "@geoscene/core/config.js";
geosceneConfig.assetsPath = "./assets"; 

app.component.css

@import "@geoscene/core/assets/geoscene/themes/light/main.css";

对于其他安装,请考虑使用此 npm 脚本作为起点:

package.json

{
  "script": {
    "copy": "cp -R ./node_modules/@geoscene/core/assets ./dist/assets"
  }
}

Windows 用户可以使用 xcopyncp 适用于任何平台。

资源

许可

易智瑞信息技术有限公司版权所有 © 2022并保留所有权利。发行于中华人民共和国。

本材料在 GeoScene 主许可协议(MLA)下许可使用,并受该协议条款的约束。 只要遵守主许可协议中的条款并包括此版权声明,您即可在不进行修改的情况下 重新分发和使用这些代码。

查看 https://links.geoscene.cn/legal/GeoScene_EULA.pdf 了解使用限制

Keywords

FAQs

Package last updated on 13 Dec 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc