Skip to content

Commit 8d0965f

Browse files
Merge pull request #250 from digital-land/maplibre_rollup
Maplibre rollup hotfix
2 parents 3b48565 + 8144154 commit 8d0965f

File tree

6 files changed

+22
-9
lines changed

6 files changed

+22
-9
lines changed

Makefile

+2
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ govukAssets::
110110
npx nps copy.govukAssets
111111

112112
javascripts:
113+
npm run build
113114
rsync -r assets/javascripts static/
114115

115116
robots:
@@ -122,6 +123,7 @@ frontend:
122123
make stylesheets
123124
make govukAssets
124125
rsync -r assets/images static/
126+
cp node_modules/maplibre-gl/dist/maplibre-gl.css static/stylesheets/maplibre-gl.css
125127

126128
frontend-all: clean frontend
127129

application/templates/entity.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
{% endblock %}
3030

3131
{%- block mapAssets %}
32-
<script src='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.js'></script>
33-
<link href='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.css' rel='stylesheet' />
32+
<script src='/static/javascripts/maplibre-gl.js'></script>
33+
<link href='/static/stylesheets/maplibre-gl.css' rel='stylesheet' />
3434
<script src='https://api.mapbox.com/mapbox.js/plugins/turf/v2.0.2/turf.min.js'></script>
3535
{{ super() }}
3636
{% endblock -%}

application/templates/national-map.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
%}
1515

1616
{%- block mapAssets %}
17-
<script src='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.js'></script>
18-
<link href='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.css' rel='stylesheet' />
17+
<script src='/static/javascripts/maplibre-gl.js'></script>
18+
<link href='/static/stylesheets/maplibre-gl.css' rel='stylesheet' />
1919
{{ super() }}
2020
{% endblock -%}
2121

application/templates/search.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
{% from 'components/pagination/macro.jinja' import appPagination %}
1313

1414
{%- block mapAssets %}
15-
<script src='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.js'></script>
16-
<link href='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.css' rel='stylesheet' />
15+
<script src='/static/javascripts/maplibre-gl.js'></script>
16+
<link href='/static/stylesheets/maplibre-gl.css' rel='stylesheet' />
1717
<script src='https://api.mapbox.com/mapbox.js/plugins/turf/v2.0.2/turf.min.js'></script>
1818
{{ super() }}
1919
{% endblock -%}

package.json

+4-3
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,14 @@
3131
"test": "vitest run",
3232
"coverage": "vitest run --coverage",
3333
"test-unit": "vitest run --dir tests/unit/javascript",
34-
"test-integration": "vitest run --dir tests/integration/javascript"
34+
"test-integration": "vitest run --dir tests/integration/javascript",
35+
"build": "rollup -c"
3536
},
3637
"dependencies": {
3738
"copyfiles": "^2.4.1",
3839
"govuk-frontend": "4.2.0",
39-
"node-sass": "^9.0.0",
40-
"nps": "^5.10.0"
40+
"maplibre-gl": "^4.1.2",
41+
"node-sass": "^9.0.0"
4142
},
4243
"devDependencies": {
4344
"@vitest/coverage-v8": "^0.34.1",

rollup.config.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// get the config object from the package file
2+
module.exports = [
3+
{
4+
input: `./node_modules/maplibre-gl/dist/maplibre-gl.js`,
5+
output: {
6+
file: `static/javascripts/maplibre-gl.js`,
7+
format: "iife",
8+
}
9+
},
10+
];

0 commit comments

Comments
 (0)