mirror of
https://github.com/apache/superset.git
synced 2026-04-07 10:31:50 +00:00
fix(templates): restore css_bundle calls in spa.html for production builds (#38350)
This commit is contained in:
committed by
GitHub
parent
c35bf344a9
commit
2ab9d37a00
@@ -67,6 +67,11 @@
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{{ css_bundle(assets_prefix, 'theme') }}
|
||||
{% if entry %}
|
||||
{{ css_bundle(assets_prefix, entry) }}
|
||||
{% endif %}
|
||||
|
||||
{{ js_bundle(assets_prefix, 'theme') }}
|
||||
|
||||
{% block head_js %}
|
||||
|
||||
@@ -14,12 +14,13 @@
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
from os.path import dirname
|
||||
from os.path import dirname, join
|
||||
from unittest.mock import Mock
|
||||
|
||||
from superset.extensions import UIManifestProcessor
|
||||
|
||||
APP_DIR = f"{dirname(__file__)}/fixtures"
|
||||
SUPERSET_DIR = join(dirname(__file__), "..", "..", "superset")
|
||||
|
||||
|
||||
def test_get_manifest_with_prefix():
|
||||
@@ -49,3 +50,21 @@ def test_get_manifest_no_prefix():
|
||||
assert manifest["js_manifest"]("styles") == ["/static/dist/styles-js.js"]
|
||||
assert manifest["css_manifest"]("styles") == []
|
||||
assert manifest["assets_prefix"] == ""
|
||||
|
||||
|
||||
def test_spa_template_includes_css_bundles():
|
||||
"""
|
||||
Verify spa.html loads CSS bundles for production builds.
|
||||
"""
|
||||
template_path = join(SUPERSET_DIR, "templates", "superset", "spa.html")
|
||||
with open(template_path) as f:
|
||||
template_content = f.read()
|
||||
|
||||
assert "css_bundle(assets_prefix, 'theme')" in template_content, (
|
||||
"spa.html must call css_bundle for the 'theme' entry to load "
|
||||
"extracted CSS (including font @font-face declarations) in production builds"
|
||||
)
|
||||
assert "css_bundle(assets_prefix, entry)" in template_content, (
|
||||
"spa.html must call css_bundle for the page entry to load "
|
||||
"entry-specific extracted CSS in production builds"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user