Skip to content

Commit

Permalink
Add version to filename of JS file and minify it
Browse files Browse the repository at this point in the history
  • Loading branch information
JasperCraeghs committed Aug 2, 2024
1 parent 3af8d11 commit d4297c0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mlx/traceability/traceability.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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]
Expand Down
8 changes: 7 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -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 = [
Expand All @@ -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',
Expand Down Expand Up @@ -65,5 +71,5 @@
'ISO26262',
'ASIL',
],
package_data={'mlx.traceability': ['assets/*.js']},
package_data={'mlx.traceability': ['assets/traceability-*.js']},
)

0 comments on commit d4297c0

Please sign in to comment.