Skip to content

Commit

Permalink
refactor: tidy up script load file
Browse files Browse the repository at this point in the history
  • Loading branch information
hydrosquall committed Apr 17, 2022
1 parent e3ecf2f commit 5c019df
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -31,13 +31,13 @@ datasette install datasette-nteract-data-explorer
- Use "advanced settings" mode to override the inferred column types. For example, you may want to treat a number as a "string" to be able to use it as a category.
- See a [live demo](https://data-explorer.nteract.io/) of the original Nteract data-explorer component used in isolation.

You can run the a minimal demo locally after installing the plugin
You can run a minimal demo after the installation step

```bash
datasette -i demo/happy_planet_index.db
```

Or, run a copy of the demo site. This will contain additional plugins and metadata used in the [published demo](https://datasette-nteract-data-explorer.vercel.app).
If you're interested in improving the demo site, you can run a copy of the site the extra metadata/plugins used in the [published demo](https://datasette-nteract-data-explorer.vercel.app).

```bash
make run-demo
Expand All @@ -57,4 +57,4 @@ See [contributing docs](./docs/CONTRIBUTING.md).
- Demo dataset from the [Happy Planet Index](https://happyplanetindex.org/) was cleaned by Doris Lee. This dataset was chosen because of its global appeal, modest size, and variety in column datatypes (numbers, low cardinality and high cardinality strings, booleans).
- Hosting for the demo site is provided by Vercel.

[![site hosted by vercel logo](https://www.datocms-assets.com/31049/1618983297-powered-by-vercel.svg)](https://vercel.com/?utm_source=datasette-visualization-plugin-demos&utm_campaign=oss)
[![site hosted by vercel](https://www.datocms-assets.com/31049/1618983297-powered-by-vercel.svg)](https://vercel.com/?utm_source=datasette-visualization-plugin-demos&utm_campaign=oss)
8 changes: 5 additions & 3 deletions demo/demo-plugins/footer.py
@@ -1,8 +1,10 @@
from datasette import hookimpl
import os
from os import path

# Store JS in separate file to enable basic IDE hinting support
script_name = path.join(path.dirname(__file__), "footer.js")
SCRIPT = open(script_name).read()

# set variable named script equal to contents of footer.js\
SCRIPT = open(os.path.join(os.path.dirname(__file__), "footer.js")).read()

@hookimpl
def extra_body_script():
Expand Down

0 comments on commit 5c019df

Please sign in to comment.