diff --git a/mlx/traceability/traceability.py b/mlx/traceability/traceability.py index 2f6f3bcc..e4ebdafb 100644 --- a/mlx/traceability/traceability.py +++ b/mlx/traceability/traceability.py @@ -479,7 +479,7 @@ def setup(app): # Javascript and stylesheet for the tree-view app.add_js_file('https://cdn.rawgit.com/aexmachina/jquery-bonsai/master/jquery.bonsai.js') app.add_css_file('https://cdn.rawgit.com/aexmachina/jquery-bonsai/master/jquery.bonsai.css') - app.add_js_file('traceability.js') + app.add_js_file(f'traceability-{version}.min.js') # Since Sphinx 6, jquery isn't bundled anymore and we need to ensure that # the sphinxcontrib-jquery extension is enabled. diff --git a/pyproject.toml b/pyproject.toml index ba5cd66d..889a6227 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools>=61", "setuptools_scm>=7.1.0"] +requires = ["setuptools>=61", "setuptools_scm>=7.1.0", "css-html-js-minify>=2.5.5,<3"] build-backend = "setuptools.build_meta" [tool.setuptools_scm] diff --git a/setup.py b/setup.py index 68758e89..98a63740 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,11 @@ # -*- coding: utf-8 -*- +from css_html_js_minify import process_single_js_file from setuptools import setup, find_namespace_packages +from setuptools_scm import get_version +version = get_version() + project_url = 'https://github.com/melexis/sphinx-traceability-extension' requires = [ @@ -13,6 +17,8 @@ 'python-decouple', 'requests', ] +js_file_path = 'mlx/traceability/assets/traceability.js' +process_single_js_file(js_file_path, output_path=js_file_path.replace('.js', f'-{version}.min.js')) setup( name='mlx.traceability', @@ -65,5 +71,5 @@ 'ISO26262', 'ASIL', ], - package_data={'mlx.traceability': ['assets/*.js']}, + package_data={'mlx.traceability': ['assets/traceability-*.js']}, )