使用Clojurescript和React构建的单页面应用程序的项目布局

时间:2014-02-24 22:35:53

标签: clojurescript singlepage reactjs

我想使用Clojurescript和React(通过Om)构建单页Web应用程序,我想知道如何为这样的项目布局目录结构?该项目不包含任何后端代码。到目前为止,我设想了以下布局:

/[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

这样的项目是否有已建立的“标准布局”,与Rails,Django等框架所施加的布局相当?

1 个答案:

答案 0 :(得分:2)

看起来不错,但你应该有一个资源/公共,并且index.html等模板和未解析的CSS可以在资源中使用gruntfile来解析它们到公共文件夹(这是服务器应该服务的那个)

修改:添加了一个示例

/[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

服务器应指向resources/public/来提供文件