howto

Use custom static files (JS, CSS) in a webapp

June 22, 2015

There are many JavaScript or CSS libraries useful for visualizations. If you want to use a specific one in your webapp, here’s how:

  1. Go to the DSS Data Directory
  2. Check for the presence of a local/static directory. Create it if needed: inside a terminal, enter
    mkdir -p local/static
  3. Copy your static files into this directory. For instance, you might copy your team's CSS and Javascript common files.
  4. You can now use the static files from the HTML code of your web app this way:
<script src="/local/static/my-team.js"></script>
<link rel="stylesheet" href="/local/static/my-team.css"/>

That's it! You can now use your favorite Javascript or CSS libs in DSS!

A word of explanation: this works thanks to DATA_DIR/nginx/conf/nginx.conf, which maps /local/static/ to dss-data-dir/local/static/.