Closed p-b-west closed 9 years ago
Mostly looks good, how do you ensure that non-minified React is included in dev mode though. If I recall correctly, the minified version makes it harder to trace errors.
I'm personally in favor of leaving Selmer in. I find there's always some server side templating in most apps, so having that setup by default is handy. However, if the additional logic is not required for dev/prod it makes sense to move it out of the template.
Ah ok so I did a bit of testing everything seems to be working well. I just realized the React is not a problem is it's packaged non-minified and will be minified during advanced compilation. I reverted back to minifying css for uberjar builds however. The latest is now up on Clojars.
Out timezones are way out of sync!
I'm still floundering around in this stuff, but cljsjs.react packages both readable and minified React versions with different names. Here are the contents of cljsjs/react-0.12.2-5.jar. META-INF/MANIFEST.MF cljsjs/common/ cljsjs/ cljsjs/common/react.ext.js cljsjs/development/ cljsjs/development/react.inc.js cljsjs/production/ cljsjs/production/react.min.inc.js deps.cljs META-INF/maven/cljsjs/react/ META-INF/maven/cljsjs/ META-INF/maven/ META-INF/ META-INF/maven/cljsjs/react/pom.xml META-INF/maven/cljsjs/react/pom.properties
This structure derives from the development of boot and boot-cljs as an alternative to lein. The deps.cljs file contains this (prettified): {:foreign-libs [{:file "cljsjs/development/react.inc.js", :file-min "cljsjs/production/react.min.inc.js", :provides ["cljsjs.react"]}], :externs ["cljsjs/common/react.ext.js"]}
That's how clojurescript finds the minified version when it is building for prod, and why the :externs entry is no longer required. Note the funny names. They're not necessary given the keywords, but boot-cljs uses the names to work out which files go where. The cljsjs packaging is now dual purpose; it serves the interests of both boot-cljs and clojurescript builds.
Right that makes sense. I guess one downside here is that it prevents using CDN caching for React, but that shouldn't be an issue in most cases.
At the moment, I think the minified libs will find their way into the preamble. I suppose that CDN caching will be addressed by someone farther down the road. ("Farther" has almost disappeared from the language, hasn't it?)
Heh yeah I don't hear farther used often. :)
You might want to compare this to the changes you are planning to make. There has been no comprehensive testing, but initial runs in a dev environment with figwheel have not completely collapsed.
Uses the new snapshot of weasel, the newish snapshot of piggieback, and the latest alpha of reagent.
Selmer templates have been stripped out of index.html. I don't think they are required for dev and prod javascript, but I have also removed them for css.min. If you decide to leave Selmer out, index.html could be moved up out of templates, I think.