简体   繁体   English

ClojureScript针对多页面Web应用程序的独立构建

[英]ClojureScript's separate builds for multipage web app

I have a web app that uses Clojure on backend and ClojureScript on frontend, and it consists of several pages, each requiring appropriate builded js file. 我有一个在后端使用Clojure和在前端使用ClojureScript的Web应用程序,它由几个页面组成,每个页面都需要适当的构建js文件。

Now I know that cljsbuild can build separate builds (if specified in :builds section of config file), provided that each build has it's own folder. 现在我知道cljsbuild可以构建单独的构建(如果在 config文件的build部分中指定),前提是每个构建都有自己的文件夹。

Problem is : now I need to duplicate some shared code in each folder in order to build properly. 问题是 :现在我需要在每个文件夹中复制一些共享代码才能正确构建。 Besides, it's really annoying that I have to create whole new folder for even trivial cljs file to be used, not to mention editing every time the :builds section of my project.clj. 除此之外,我必须为即使是简单的cljs文件创建全新的文件夹,更不用说每次我的project.clj的:builds部分都要编辑。

So, it's 2016, and all the tutorials on ClojureScript I've seen so far, are for single-page applications. 所以,它是2016年,到目前为止,我所见过的关于ClojureScript的所有教程都是针对单页应用程序的。 Are there any resources or best practices for what I'm looking for, am I missing something out? 我正在寻找什么资源或最佳实践,我错过了什么?

How do I use ClojureScript in standard multi-page Clojure-stack web app? 如何在标准的多页Clojure堆栈Web应用程序中使用ClojureScript?

Thanks. 谢谢。

:modules编译器选项可用于将clojurescript构建拆分为可根据需要提供的优化模块。

Do you really need multiple cljs builds? 你真的需要多个cljs构建吗?

Can't you just create a single one, export ing the components you need and hooking them up into dom whenever they are needed? 难道你不能只创建一个, export你需要的组件,并在需要时将它们连接到dom中吗?

It may be as easy as using require from one namespace into another. 它可能就像从一个命名空间到另一个命名空间使用require一样容易。

For instance, say that you have the following structure : 例如,假设您具有以下结构:

project ├── src │ └── cljs │ ├── page1 │ ├── page2 │ │

You could require things from the namespace page1.subnamespace from inside page2 . 你可能require从命名空间中的东西page1.subnamespace从内page2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 是否可以使用Clojurescript或Google Closure编写Chrome扩展程序或网络应用程序? - Is it possible to use Clojurescript or Google Closure to write Chrome extensions or web app? 在Clojurescript中使用“外部” - Using “extern”s in Clojurescript 如何改进编辑依赖项和观察主 Clojure/ClojureScript 动态 web 应用程序项目的变化的工作流程? - How to improve the workflow of editing dependencies and watching the changes on a main Clojure/ClojureScript dynamic web app project? 使用Clojure / ClojureScript进行Web开发的后端 - Backend for Web Development using Clojure/ClojureScript 如何发布/部署Clojurescript应用程序? - How to do a release/deploy build of a clojurescript app? ClojureScript Electron应用程序__dirname返回nil - ClojureScript Electron app __dirname returns nil Wolfram语言在ClojureScript中的折叠相当于什么? - What is the equivalent of Wolfram Language's Fold in ClojureScript? 如何使用Git部署和同步原型Clojurescript应用程序? - How to deploy and sync a prototype Clojurescript app with Git? 为Compojure应用程序自动构建Clojurescript文件 - Auto building Clojurescript files for Compojure app 如何耗尽通道的值然后返回结果(ClojureScript)? - How to exhaust a channel's values and then return the result (ClojureScript)?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM