Skip to content

Commit 2558365

Browse files
committed
Reference function-plot.js directly from index.html
In webpack the response will be computed by webpack. In a static server the files will be available after build.
1 parent 89929b1 commit 2558365

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
/site/js/*function-plot.js
2-
/site/js/*function-plot.js.map
1+
/site/*function-plot.js
2+
/site/*function-plot.js.map
33
/dist
44
/site/partials/examples.html
55
/site/partials/recipes.html

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"build": "npx rimraf dist && npm run html && npm run docs && npm run build:typescript && npm run build:webpack && npm run build:site",
2626
"build:webpack": "NODE_ENV=production webpack",
2727
"build:typescript": "tsc && mkdir -p dist/samplers && cp src/samplers/*.mjs dist/samplers/",
28-
"build:site": "cp dist/*function-plot.js site/js && cp dist/*function-plot.js.map site/js",
28+
"build:site": "cp dist/*function-plot.js* site/",
2929
"start": "webpack-dev-server",
3030
"docs": "typedoc --excludeExternals --externalPattern \"**/node_modules/**\" --out site/docs src/index.ts",
3131
"test": "npm run test:jest && npm run test:format",

site/index.html

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -205,13 +205,7 @@ <h1><span class="logo">$f(x)$</span> - Function Plot<br /></h1>
205205
<script src="js/plugins.js"></script>
206206

207207
<!-- app -->
208-
<script>
209-
if (window.location.origin.indexOf('localhost') > -1) {
210-
document.write('<script src="function-plot.js"><\/script>')
211-
} else {
212-
document.write('<script src="js/function-plot.js"><\/script>')
213-
}
214-
</script>
208+
<script src="function-plot.js"></script>
215209
<script src="js/site.js"></script>
216210
<script>
217211
$('#recipes').load('partials/recipes.html')

0 commit comments

Comments
 (0)