I am using some 3rd party JS file which uses an import statement inside the JS file itself. I am using Django, and that css file is in STATICFILES_DIRS
, which I can access through {% static 'css/main.css' %}
. This is the file being imported.
In js this is being imported something like this
import '../../css/main.css'
I have declared a variable in index.html that holds this value
index.html
<script type="text/javascript">
const main_css = "{% static 'css/main.css' %}"
</script>
In my main.js file I am using this syntax
@import `${main_css}`
which doesn't work, the DOM doesn't change. Any tips?