Skip to content

Commit

Permalink
add rollup for maplibre
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeGoodall committed Apr 12, 2024
1 parent 3b48565 commit 13beef1
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ govukAssets::
npx nps copy.govukAssets

javascripts:
npm run build
rsync -r assets/javascripts static/

robots:
Expand Down
2 changes: 1 addition & 1 deletion application/templates/national-map.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
%}

{%- block mapAssets %}
<script src='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.js'></script>
<script src='/static/javascripts/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.css' rel='stylesheet' />
{{ super() }}
{% endblock -%}
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,14 @@
"test": "vitest run",
"coverage": "vitest run --coverage",
"test-unit": "vitest run --dir tests/unit/javascript",
"test-integration": "vitest run --dir tests/integration/javascript"
"test-integration": "vitest run --dir tests/integration/javascript",
"build": "rollup -c"
},
"dependencies": {
"copyfiles": "^2.4.1",
"govuk-frontend": "4.2.0",
"node-sass": "^9.0.0",
"nps": "^5.10.0"
"maplibre-gl": "^4.1.2",
"node-sass": "^9.0.0"
},
"devDependencies": {
"@vitest/coverage-v8": "^0.34.1",
Expand Down
10 changes: 10 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// get the config object from the package file
module.exports = [
{
input: `./node_modules/maplibre-gl/dist/maplibre-gl.js`,
output: {
file: `static/javascripts/maplibre-gl.js`,
format: "iife",
}
},
];

0 comments on commit 13beef1

Please sign in to comment.