Skip to content

Commit

Permalink
rearrange dist files
Browse files Browse the repository at this point in the history
  • Loading branch information
iamfrank committed Nov 30, 2023
1 parent 3ad52f0 commit 7e8999f
Show file tree
Hide file tree
Showing 36 changed files with 237 additions and 110 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Før brug skal man oprette en bruger på [Dataforsyningen](https://dataforsyning
2. Log ind på dataforsyningen.dk med din nye bruger, og opret en token.
3. Indsæt `<script>`-tag i `<head>`-tagget på din hjemmeside
- Benyt enten vores CDN: `<script src="https://cdn.jsdelivr.net/gh/SDFIdk/okapi@latest/lib/@dataforsyningen/okapi-1.9.2.min.js"
integrity="sha384-cCAC7s7IFClo6yA0J2Sr2IqO7uLhTkHuQofDk6RHNOIaP+zQH2txDPDh2h0bE8Cj"
integrity="sha384-SgEw9Obq1dyR6wtxJA65RKk3C/YrDqC0Dl79+dBxqQChkHJ/KRBCNKTsUq6Tmxal"
crossorigin="anonymous"></script>`
- Eller hav filen liggende på din egen server: `<script src="/path/to/okapi.min.js"></script>`
4. Indsæt `<div id="map" class="geomap" data-token="...">`-tag, dér hvor du vil have kortet.
Expand Down Expand Up @@ -74,7 +74,7 @@ F.eks. i dette tilfælde, hvor vi har bygget okapi ind i filerne `bundled.js` og

```html
<script src="https://cdn.jsdelivr.net/gh/SDFIdk/okapi@latest/lib/@dataforsyningen/okapi-1.9.2.min.js"
integrity="sha384-cCAC7s7IFClo6yA0J2Sr2IqO7uLhTkHuQofDk6RHNOIaP+zQH2txDPDh2h0bE8Cj"
integrity="sha384-SgEw9Obq1dyR6wtxJA65RKk3C/YrDqC0Dl79+dBxqQChkHJ/KRBCNKTsUq6Tmxal"
crossorigin="anonymous"></script>
```

Expand Down
45 changes: 23 additions & 22 deletions build/build-es.mjs
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
import esbuild from 'esbuild'
import { stylusLoader } from 'esbuild-stylus-loader'

const entry_points = {
index: 'src/Index.js'
}

console.log('--------------------------')
console.log('Building ES module')

const destinations = ['dist', 'examples']

// Production build

esbuild.build({
entryPoints: ['src/Index.js'],
outfile: 'dist/index.js',
bundle: true,
minify: true,
format: 'esm',
sourcemap: true,
loader: {
'.png': 'dataurl'
},
plugins: [
stylusLoader()
]
})
.then((response) => {
console.log('Build finished. `dist` updated 👍')
})
.catch(() => process.exit(1))
destinations.forEach((destination) => {

esbuild.build({
entryPoints: ['src/Index.js'],
outfile: `${ destination }/okapi.js`,
bundle: true,
minify: true,
format: 'esm',
sourcemap: true,
loader: {
'.png': 'dataurl'
},
plugins: [
stylusLoader()
]
})
.then((response) => {
console.log('Build finished. `dist` updated 👍')
})
.catch(() => process.exit(1))

})
7 changes: 1 addition & 6 deletions build/build-examples.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,13 @@ try {
title = title.replace('.html', '').replace('-', ' ').replace(/^./g, title[0].toUpperCase())

const markup = await readHTML(`${ src_dir }/html/${ file }`)

const css_str = `../lib/${ pkg.name }-${ pkg.version }.min.css`
const js_str = `../lib/${ pkg.name }-${ pkg.version }.min.js`

let temp = template_html.replace('InsertContentHere', markup).replace('InsertYourTitleHere', title)
temp = temp.replace('InsertCSSHere', css_str)
temp = temp.replace('InsertJSHere', js_str)
temp = temp.replaceAll('InsertYourTokenHere', token)
temp = temp.replaceAll('InsertYourUsernameHere', username)
temp = temp.replaceAll('InsertYourPasswordHere', password)

const code_css_str = `https://cdn.jsdelivr.net/gh/SDFIdk/okapi@latest/lib/${ pkg.name }-${ pkg.version }.min.css`
const code_css_str = `https://cdn.jsdelivr.net/gh/SDFIdk/okapi@latest/dist/okapi.min.css`
const code_js_str = `https://cdn.jsdelivr.net/gh/SDFIdk/okapi@latest/lib/${ pkg.name }-${ pkg.version }.min.js`


Expand Down
2 changes: 2 additions & 0 deletions dist/okapi.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 7e8999f

Please sign in to comment.