GithubHelp home page GithubHelp logo

chillgis / vuelayers Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ghettovoice/vuelayers

0.0 2.0 0.0 7.91 MB

Vue components to work with OpenLayers

Home Page: https://ghettovoice.github.io/vuelayers/

License: MIT License

JavaScript 61.65% Vue 37.42% CSS 0.13% HTML 0.80%

vuelayers's Introduction

VueLayers

Vue components to work with OpenLayers

Build Status Coverage Status js-standard-style GitHub tag NPM version License Dependencies Dev dependencies

Demo

Install

# install Vue and VueLayers
npm install -S vue vuelayers

Available builds

  1. UMD
  • Full debug version: dist/vuelayers.umd.js and dist/vuelayers.umd.css
  • Full production version: dist/vuelayers.umd.min.js and dist/vuelayers.umd.min.css
  1. CommonJS
  • Full version: dist/vuelayers.cjs.js and dist/vuelayers.cjs.css
  1. CommonJS separate components (for plugins like babel-plugin-component)
  • Main: dist/modules/index.js and dist/modules/style.css
  • Components: dist/modules/%component-name%/index.js and dist/modules/%component-name%/style.css
  1. ES6 module
  • Full version: dist/vuelayers.es.js and dist/vuelayers.es.css

Usage

Basic example with full import

// main.js
import Vue from 'vue'
import VueLayers from 'vuelayers'

Vue.use(VueLayers)
// now all components installed and ready to use
new Vue({
  el: '#app',
  render: h => h(App)
})
// App.vue
<template>
  <div id="map">
    <vl-map>
      <vl-view />
      
      <vl-layer-tile>
        <vl-source-osm />
      </vl-layer-tile>
    </vl-map>
  </div>
</template>
<script>
  export default {}
</script>
<style>
  /* CSS file needs to be imported separately. */
  @import "~vuelayers/dist/vuelayers.";
</style>

Note about usage of different builds

  • For browser is available pre-build UMD version by simply including dist/vuelayers.umd.min.js and vuelayers.umd.min.css files on the page after VueJS.
    Or use from CDN like unpkg.org.

  • For NodeJS is available CommonJS version (it is included by default) from dist/vuelayers.cjs.js and appropriate stylesheet dist/vuelayers.cjs.css.
    See below for example of incremental loading of what you need with tools like babel-plugin-component.

  • For bundlers like Webpack 2 and Rollup is available ES6 module version from dist/vuelayers.es.js and appropriate stylesheet dist/vuelayers.es.css.

Incremental import

With Webpack 2 or Rollup may be used without additional configuration, simply import what you need. Stylesheet should be imported manually (dist/vuelayers.es.css).

import Vue from 'vue'
import { Map, View, TileLayer, OsmSource } from 'vuelayers'

Vue.use(Map)
Vue.use(View)
Vue.use(TileLayer)
Vue.use(OsmSource)

new Vue({
  el: '#app',
  render: h => h(App)
})

For native CommonJS or bundlers that doesn't support ES6 module system you can use tools like babel-plugin-component for incremental loading.
First, install babel-plugin-component Example Babel config

{
  "presets": [
    ["latest", "stage-2"]
  ],
  "plugins": [["component", [
    {
      "libraryName": "vuelayers",
      "style": true,
      "libDir": "dist/modules"
    }
  ]]]
}

Now you can import only what you need, only that components will be included in final build.

Documentation

TODO

Build Setup

git clone https://gitlab.com/ghettovoice/vuelayers.git
cd vuelayers

# install dependencies
npm install

# serve with hot reload at localhost:8080
npm start

# demo 
npm run demo

# build
npm run build

# run unit tests
npm run unit

# run e2e tests
npm run e2e

# run all tests
npm test

License

MIT (c) 2017, Vladimir Vershinin
Based on Vue and OpenLayers

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.