Search code examples
clojurescriptsinglepagereactjs

Project layout for single-page app built using Clojurescript and React


I want to build a single-page web application using Clojurescript and React (via Om) and I wonder how to lay out the directory structure for such a project? The project will not contain any backend code. So far, I envisaged the following layout:

/[app name]
           /assets
                  /css
                  /js
                  /cljs
                  /...
           /src
                  /[module 1]
                             /view1.cljs
                             /view2.cljs
           /templates
                     /layouts/
                              layout1.html
                     /[module 1]/
                                 view1.html
                                 view2.html
           /test
                /[module 1]
                           /test_view1.cljs
                           /test_view2.cljs
           /doc
               /src
                   /index.rst
               /build
           README.md

Is there an established "standard layout" for such a project, comparable to the layout imposed by frameworks like Rails, Django or the like?


Solution

  • Looks good, but you should have a resources / public and there index.html, etc. templates and unparsed CSS could to in resources with a gruntfile that could parse them into the public folder ( that's the one the server should serve).

    Edit: Added an example

    /[app name]
      src/
        cljs/
          [app_name]/
            core.cljs
        clj/
      test/
      doc/
        index.srt
      resources/
        css/
          index.less
        templates/
          layouts/
            default.jade
          index.jade
        Gruntfile.js
        public/ ; Here grunt and cljsbuild will compile all the resources ->
          index.html
          js/
          cljs/
          css/
            index.css
    

    Server should point to resources/public/ to serve the files