mirror of
https://github.com/django-components/django-components.git
synced 2025-09-26 15:39:08 +00:00
feat: allow globs when specifynigg additionall JS and CSS (#1043)
* feat: allow globs when specifynigg additionall JS and CSS * refactor: fix tests and linter errors
This commit is contained in:
parent
73e94b6714
commit
ab75cfdb8f
12 changed files with 282 additions and 97 deletions
23
tests/components/glob/glob.py
Normal file
23
tests/components/glob/glob.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
|
||||
from django_components import Component
|
||||
|
||||
|
||||
# The Media JS / CSS glob and are relative to the component directory
|
||||
class GlobComponent(Component):
|
||||
template = """
|
||||
{% load component_tags %}
|
||||
{% component_js_dependencies %}
|
||||
{% component_css_dependencies %}
|
||||
"""
|
||||
|
||||
class Media:
|
||||
css = "glob_*.css"
|
||||
js = "glob_*.js"
|
||||
|
||||
|
||||
# The Media JS / CSS glob and are relative to the directory given in
|
||||
# `COMPONENTS.dirs` and `COMPONENTS.app_dirs`
|
||||
class GlobComponentRootDir(GlobComponent):
|
||||
class Media:
|
||||
css = "glob/glob_*.css"
|
||||
js = "glob/glob_*.js"
|
3
tests/components/glob/glob_1.css
Normal file
3
tests/components/glob/glob_1.css
Normal file
|
@ -0,0 +1,3 @@
|
|||
.html-css-only {
|
||||
color: blue;
|
||||
}
|
1
tests/components/glob/glob_1.js
Normal file
1
tests/components/glob/glob_1.js
Normal file
|
@ -0,0 +1 @@
|
|||
console.log("JS file");
|
3
tests/components/glob/glob_2.css
Normal file
3
tests/components/glob/glob_2.css
Normal file
|
@ -0,0 +1,3 @@
|
|||
.html-css-only {
|
||||
color: blue;
|
||||
}
|
1
tests/components/glob/glob_2.js
Normal file
1
tests/components/glob/glob_2.js
Normal file
|
@ -0,0 +1 @@
|
|||
console.log("JS file");
|
Loading…
Add table
Add a link
Reference in a new issue