Move new examples to site/src/examples

This commit is contained in:
Tim Schaub
2018-05-27 16:19:29 -06:00
parent 54c438997f
commit ee27cf1e01
8 changed files with 30 additions and 26 deletions

View File

@@ -1,17 +0,0 @@
import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js';
import TileLayer from '../src/ol/layer/Tile.js';
import OSM from '../src/ol/source/OSM.js';
const map = new Map({
layers: [
new TileLayer({
source: new OSM()
})
],
target: 'map',
view: new View({
center: [0, 0],
zoom: 1
})
});

View File

@@ -14,7 +14,7 @@ module.exports = {
resolve: 'gatsby-source-filesystem',
options: {
name: 'examples',
path: path.join(__dirname, '..', 'new-examples')
path: path.join(__dirname, 'src', 'examples')
}
},
{

View File

@@ -181,7 +181,7 @@ exports.createPages = async (
frontmatter: markdownNode.frontmatter,
embedUrl: `/${embedDirName}/${embedName}`,
html: markdownNode.html,
js: source.replace(/'\.\.\/src\/(.*?)\.js/g, "'$1"),
js: source.replace(/'\.\.\/\.\.\/\.\.\/src\/(.*?)\.js/g, "'$1"),
css: exampleCss
}
});

View File

@@ -1,9 +1,12 @@
import Map from '../src/ol/Map.js';
import View from '../src/ol/View.js';
import GeoJSON from '../src/ol/format/GeoJSON.js';
import {Tile as TileLayer, Vector as VectorLayer} from '../src/ol/layer.js';
import {BingMaps, Vector as VectorSource} from '../src/ol/source.js';
import {Style, Stroke} from '../src/ol/style.js';
import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import GeoJSON from '../../../src/ol/format/GeoJSON.js';
import {
Tile as TileLayer,
Vector as VectorLayer
} from '../../../src/ol/layer.js';
import {BingMaps, Vector as VectorSource} from '../../../src/ol/source.js';
import {Style, Stroke} from '../../../src/ol/style.js';
const map = new Map({
layers: [
@@ -16,7 +19,8 @@ const map = new Map({
new VectorLayer({
source: new VectorSource({
format: new GeoJSON(),
url: 'https://raw.githubusercontent.com/johan/world.geo.json/master/countries.geo.json'
url:
'https://raw.githubusercontent.com/johan/world.geo.json/master/countries.geo.json'
}),
opacity: 0.5,
style: new Style({

17
site/src/examples/map.js Normal file
View File

@@ -0,0 +1,17 @@
import Map from '../../../src/ol/Map.js';
import View from '../../../src/ol/View.js';
import TileLayer from '../../../src/ol/layer/Tile.js';
import OSM from '../../../src/ol/source/OSM.js';
const map = new Map({
layers: [
new TileLayer({
source: new OSM()
})
],
target: 'map',
view: new View({
center: [0, 0],
zoom: 1
})
});