bhauman/clojurescript-build

语言: Clojure

git: https://github.com/bhauman/clojurescript-build

一个clojurescript建筑图书馆
A clojurescript building library
README.md (中文)

ClojureScript构建

Clojars Project

构建ClojureScript的库。

它的主要贡献是了解Clojure文件的变化 cljs源路径会影响增量ClojureScript构建。

cljs.clojure / build库调用处理增量构建 关于cljs源文件的更改很好。不过它 忽略Clojure源文件中的更改如何影响构建。如果你 只更改Clojure源文件而不更改任何cljs源文件 你的clj改变不会。

这个库通过注意到一个clj文件来纠正这种情况 您的ClojureScript源路径已更改,如果是这样,它会执行其中一个 两件事情:

如果文件包含宏定义,则会找到ClojureScript 依赖于这些宏定义并标记它们的文件 重新编译。

如果文件不包含宏定义,则它将占用所有clj 依赖于当前源目录集中的宏的文件 并标记它们以进行重新编译。

这是一个简单的策略。但它导致增量大大提高 处理clj源文件时的编译时间。

用法

在项目中包含clojurescript-build作为依赖项.clj。 因为它可能只是一个开发的依赖,你可以放置 它在dev配置文件中是这样的:

:profiles {
  :dev {
    :dependencies [[clojurescript-build "0.1.0-SNAPSHOT"]]
  }
}

构建ClojureScript

您可以进行两个主要的库调用。一个单一的 构建和一个自动观看构建。

要进行单个构建调用:

(require '[clojurescript-build.core :as cljsb])

(cljsb/build-source-paths ["src" "dev/src"] ; list source directories
                          { :output-to "output/hello.js"
                            :output-dir "output/out"
                            :source-map true
                            :optimizations :none })

build-source-paths调用获取保存的目录列表 cljs源代码和构建选项映射。构建选项映射就是 传递给cljs.closure / build,因此它需要所有的 cljs.closure / build采用的选项。

要进行自动构建,其中要查看源文件的更改,然后进行更改 重新编译。

(require '[clojurescript-build.auto :as auto])

(auto/autobuild ["src" "dev/src"] ; list source directories
                { :output-to "output/hello.js"
                  :output-dir "output/out"
                  :source-map true
                  :optimizations :none })

ClojureScript编译器选项

所有ClojureScript编译器选项

执照

版权所有©2014 Bruce Hauman

根据Eclipse Public License分发版本1.0或任何版本 以后的版本。

本文使用googletrans自动翻译,仅供参考, 原文来自github.com

en_README.md

ClojureScript Build

Clojars Project

A library that builds ClojureScript.

Its main contribution is an awareness of how changed Clojure files in
cljs source paths affect an incremental ClojureScript build.

The cljs.clojure/build library call handles incremental builds
pretty well with regards to changes in cljs source files. However it
ignores how changes in Clojure source files affect a build. If you
only change a Clojure source file and none of the cljs source files
your clj changes won't take.

This library rectifies this situation by noticing if a clj file in
your ClojureScript source paths has changed, and if so, it does one of
two things:

If the file contains macro definitions, it finds the ClojureScript
files that depend on those macro definitions and marks them for
recompile.

If the file doesn't contain macro definitions, it takes all cljs
files that depend on macros in the current set of source directories
and marks them for recompile.

It's a simple strategy. But it leads to greatly improved incremental
compile times when working on clj source files.

Usage

Include clojurescript-build as a dependency in your project.clj.
Since it's probably a developement only dependency you can just place
it in the dev profile like so:

:profiles {
  :dev {
    :dependencies [[clojurescript-build "0.1.0-SNAPSHOT"]]
  }
}

Building ClojureScript

There are two main library calls that you can make. One for a single
build and one for an auto-watching build.

To do a single build call:

(require '[clojurescript-build.core :as cljsb])

(cljsb/build-source-paths ["src" "dev/src"] ; list source directories
                          { :output-to "output/hello.js"
                            :output-dir "output/out"
                            :source-map true
                            :optimizations :none })

The build-source-paths call takes a list of directories that hold
cljs source and a build options map. The build options map is just
passed on to cljs.closure/build and as so it takes all of the
options that cljs.closure/build takes.

To do an auto-build where source files are watched for changes and then
recompiled.

(require '[clojurescript-build.auto :as auto])

(auto/autobuild ["src" "dev/src"] ; list source directories
                { :output-to "output/hello.js"
                  :output-dir "output/out"
                  :source-map true
                  :optimizations :none })

ClojureScript Compiler Options

All ClojureScript compiler options

License

Copyright © 2014 Bruce Hauman

Distributed under the Eclipse Public License either version 1.0 or any
later version.