Comments (10)
I completely agree. I been thinking about this for a while now. Part of the thing I have been struggling with is how to integrate this type of template into the existing structure without introducing complexity to the syntax of deftemplate and defsnippet. I have a few ideas:
(defsnippet :compiled "...uri..." [...enlive syntax...] [..args..]
;;normal enfocus transform
)
or
(defcsnippet "..uri.." [...enlive syntax...]
;; normal transform stuff
)
What do you think?
from enfocus.
I like the first option better -- it's more straightforward than the 'c' in 'def_c_snippet' which is hard to spot (at least for me :)
Also, going offtopic, have you considered using domina for DOM manipulations? some of the things defined in core.cljs
are already provided by domina
-- for example 'style-set'. I think delegating this functionality to another lib will make enfocus
both easier to maintain and use.
from enfocus.
Thanks on the feedback and yes I am planning on using Domina as the base layer eventually. I have been working Luke on adding features to Domina so I can do that very thing. Now that Luke finished up the new event model I should be able to remove a bunch of code and replace it with Domina underpinnings.
from enfocus.
+1 here to @superbobry and thanks for the great lib!
from enfocus.
I am going to add another issue for the move to domina as a base layer for enfocus.
from enfocus.
Mind if I'll try to implement this myself and then submit a PR?
from enfocus.
That would be great!
On May 16, 2012 7:20 AM, "Sergei Lebedev" <
[email protected]>
wrote:
Mind if I try to implement this myself and then submit a PR?
Reply to this email directly or view it on GitHub:
#3 (comment)
from enfocus.
Okay, I got it working, but it looks like we can't make this change without breaking backward compatibility. The current implementation is:
(defmacro deftemplate [sym mode uri args & forms]
`(do
~@(case mode
:remote `(enfocus.core/load-remote-dom ~uri)
:compiled (load-local-dom uri))
(enfocus.macros/create-dom-action
~sym
#(enfocus.core/get-cached-dom ~uri)
true ~args ~@forms)))
So old deftemplate
behavior can be achieved with :remote
tag. Is there a way to have both old and new versions for a single name?
from enfocus.
How about something more like this. It keeps backwards compatibility. Note: I just scetch this out and have not run it.
(defmacro deftemplate [sym & body]
(let [[mode [uri args & forms]] (if (= (first body) :compiled)
[:compiled (rest body)]
[:remote body])]
`(do
~@(case mode
:remote `(enfocus.core/load-remote-dom ~uri)
:compiled (load-local-dom uri))
(enfocus.macros/create-dom-action
~sym
#(enfocus.core/get-cached-dom ~uri)
true ~args ~@forms)))
from enfocus.
Yup, this looks good, thanks :)
from enfocus.
Related Issues (20)
- Need escape content in ef/content or make other function that do correct html escaping.
- transform object DocumentFragment to string HOT 5
- event handler functions within hiccup-html HOT 2
- replace-vars broken in clojurescript 1.7.145 HOT 6
- Great project
- Extractor extract node HOT 1
- Clone-for and lists HOT 15
- Hiccup input control - checked and disabled not working HOT 2
- Requiring enfocus.macros under Clojure 1.10 and above triggers an error
- compiling fails at target/cljsbuild-compiler-0/enfocus/core.cljs HOT 4
- get-prop doesn't work on data attributes HOT 1
- listen-live looses event information HOT 6
- Multiple Extractions HOT 5
- Add optional callback for when view-binding function completed HOT 6
- debug should be set to false by default HOT 4
- (read-form) on IE8 results in [object]is not ISeqable HOT 7
- How can I use holder.js in html snippet? HOT 4
- Difference in ef/content behaviour HOT 2
- clone-for issue "TypeError: enfocus.core.last_element_child is undefined" HOT 1
- Function based inline snippets HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from enfocus.