luminus-framework / luminus-framework/luminus
How to include ClojureScript into HTML page?
Nobody has claimed this yet.
- Dominant language
- CSS
- Stars
- 626
- Forks
- 122
- PR merge metrics
- No merged PRs in 30d
Description
I am following guestbook example from the book Web Development With Clojure 3rd edition. I am struggling with including ClojureScript namespace into HTML document. Everything is working fine with example where I have one core.cljs. With that file, only I have to do is to include this piece of code into home.html document:
```
{% extends "base.html" %}
{% block content %}
{% endblock %}
{% block page-scripts %}
{% script "/js/app.js" %}
{% endblock %}
```
As I mentioned, everything is ok in this situation. But when I created additional ClojureScript file and name it test.cljs and included that in the same way in the new HTML document named test.html I see errors in the console such as "Target container is not a DOM element.". I think that something is wrong with this part:
```
{% block page-scripts %}
{% script "/js/app.js" %}
{% endblock %}
```
But I can't figure out how to solve this. Actually, my question maybe should be: How to include ClojureScript into HTML file?. Is the only way this piece of code?
```
{% block page-scripts %}
{% script "/js/app.js" %}
{% endblock %}
```
Or, maybe I should change `{% script "/js/app.js" %}` part of this snippet?
Or even better, when I create simple HTML file without extending any base.html file, how to add clojurescript namespace, how to reference it? You know, like javascript helloworld example
``
How to do this in ClojureScript?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review home.html, test.html, base.html, core.cljs, test.cljs, and /js/app.js together; start by comparing the working and failing page and inspecting the reported DOM-container error. A useful resolution would document how to load and initialize an additional ClojureScript namespace, including the standalone HTML case.
Written by the indexing model from the issue text.
Assessment
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100