reagent-project / reagent-template

A Leiningen template for projects using Reagent.
MIT License
394 stars 55 forks source link

Update to accommodate clojurescript 0.0-2814, and corresponding changes in weasel #35

Closed p-b-west closed 9 years ago

p-b-west commented 9 years ago

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.

yogthos commented 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.

yogthos commented 9 years ago

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.

yogthos commented 9 years ago

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.

p-b-west commented 9 years ago

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.

yogthos commented 9 years ago

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.

p-b-west commented 9 years ago

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?)

yogthos commented 9 years ago

Heh yeah I don't hear farther used often. :)