RunestoneInteractive / RunestoneComponents

Packaging of the Runestone tools for publishing educational materials using github pages
http://runestoneinteractive.org
Other
101 stars 225 forks source link

Add: Move files to webpack. #1199

Closed bjones1 closed 3 years ago

bjones1 commented 3 years ago

My goal was to move everything possible to webpack. Some notes:

  1. All images (should) now be webpacked, instead of copying them to Sphinx's _static directory.
  2. All CSS (except for accessibility, since it depends on the select flavor) is webpacked.
  3. Libraries (handsontable, sql.js, vega, jquery.ui, bootstrap) are webpacked from npm. This makes it easy to change/upgrade versions (just change the version number in package.json).
  4. The jquery.i18n library wasn't in npm, so I manually downloaded it so we can webpack those files (hence the "edits" -- downloading the version from the web then updating these local files). I removed the old add_i19n_js function from the Runestone build, since it wasn't used.
  5. The webpack now provides a better production build, with CSS minification and creation of .css files.

This also means we can run a book with no internet connection at all; the previous version required the Internet to load the CSS/JS of many libraries. Here's a typical from a built file, showing that the number of files to load went down significantly compared to pre-webpack days:

    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <link rel="stylesheet" href="_static/basic.css" type="text/css" />
    <link rel="stylesheet" type="text/css" href="_static/CodeChat.css" />
    <link rel="stylesheet" type="text/css" href="_static/matrixeq.css?v=EA7C0F6C" />
    <link rel="stylesheet" type="text/css" href="_static/webgldemo.css?v=4EB84728" />
    <link rel="stylesheet" type="text/css" href="_static/webglinteractive.css?v=21C88BC4" />
    <link rel="stylesheet" type="text/css" href="_static/bootstrap-sphinx.css" />
    <link rel="stylesheet" type="text/css" href="_static/theme-overrides.css?v=9D08EA4" />
    <link rel="stylesheet" type="text/css" href="_static/637.css?v=fb96dc1ee8ff12285834" />
    <link rel="stylesheet" type="text/css" href="_static/runestone.css?v=5efa53702c903f7655c2" />
    <script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
    <script src="_static/jquery.js"></script>
    <script src="_static/underscore.js"></script>
    <script src="_static/doctools.js"></script>
    <script src="_static/animationbase.js?v=B45130AE"></script>
    <script src="_static/html4css1.css?v=62F7CBB1"></script>
    <script src="_static/matrixeq.js?v=1FB22B23"></script>
    <script src="_static/webglinteractive.js?v=7D80F988"></script>
    <script src="_static/FileSaver.min.js?v=8B232E7A"></script>
    <script src="_static/runtime.bundle.js?v=7fadf4aea8fdff76eb97"></script>
    <script src="_static/637.bundle.js?v=1123ad75f9b821cdd636"></script>
    <script src="_static/runestone.bundle.js?v=9a97e4225e1a57c626ce"></script>