Skip to content

Commit

Permalink
publish style
Browse files Browse the repository at this point in the history
  • Loading branch information
ccalobeto committed Sep 16, 2024
1 parent 045bcd7 commit cc0a4e8
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 7 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Deploy to GitHub Pages

on:
push:
branches: ["main"]

jobs:
build_site:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm

- name: Install dependencies
run: npm install

- name: build
env:
BASE_PATH: "/${{ github.event.repository.name }}"
run: |
npm run build
- name: Upload Artifacts
uses: actions/upload-pages-artifact@v3
with:
path: "build/"

deploy:
needs: build_site
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write

environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

steps:
- name: Deploy
id: deployment
uses: actions/deploy-pages@v4
34 changes: 32 additions & 2 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,2 +1,32 @@
<h1>Welcome to SvelteKit</h1>
<p>Visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to read the documentation</p>
<script>
import { Protocol } from 'pmtiles';
import maplibregl from 'maplibre-gl';
import { onMount } from 'svelte';
import { base } from '$app/paths';
const style = `${base}/data/styles/grayscale.json`;
let protocol = new Protocol();
maplibregl.addProtocol('pmtiles', protocol.tile);
onMount(() => {
const initialize = { lng: -77.03778, lat: -12.06649, zoom: 13.5 };
const map = new maplibregl.Map({
container: 'map',
zoom: initialize.zoom,
center: [initialize.lng, initialize.lat],
style: style
});
});
</script>

<div id="map"></div>

<style>
#map {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
}
</style>
12 changes: 7 additions & 5 deletions svelte.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import adapter from '@sveltejs/adapter-auto';
import adapter from '@sveltejs/adapter-static';

/** @type {import('@sveltejs/kit').Config} */
const config = {
kit: {
// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
// If your environment is not supported, or you settled on a specific environment, switch out the adapter.
// See https://kit.svelte.dev/docs/adapters for more information about adapters.
adapter: adapter()
adapter: adapter({
fallback: '404.html'
}),
paths: {
base: process.argv.includes('dev') ? '' : process.env.BASE_PATH
}
}
};

Expand Down

0 comments on commit cc0a4e8

Please sign in to comment.