javascript - 使用 Makefile 构建 javascript

标签 javascript node.js makefile

我克隆了一个nodejs项目,该项目包含一个Makefile

SRC = $(wildcard lib/**/*.js)
CSS = $(wildcard lib/**/*.css)
HTML = $(wildcard lib/**/*.html)
COMPONENTJSON = $(wildcard lib/*/component.json)
TEMPLATES = $(HTML:.html=.js)

build: components $(SRC) $(CSS) $(TEMPLATES)
    @echo building
    @component build

components: component.json $(COMPONENTJSON)
    @echo installing
    @component install

%.js: %.html
    @echo converting
    @component convert $<

minify:
    @component build --use component-minify

clean:
    @echo cleaning
    rm -fr build components $(TEMPLATES)

.PHONY: clean minify

我之前不知道 make 可以用来构建 javascript,当我运行 make 时,我收到错误

installing
make: component: Command not found
make: *** [components] Error 127

我的问题是,
1.它是使用unix系统提供的相同的默认make,还是使用某种其他 Node 库?
2.如果是相同的系统默认值,为什么我会收到错误?

link to the example project

最佳答案

该文件使用与任何 UNIX/Linux 系统中相同的 make。 该错误是由于 component 包不可用造成的。我使用以下方法安装了组件:

npm install -g component

关于javascript - 使用 Makefile 构建 javascript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31866545/

相关文章:

javascript - 为什么索引会这样增加? javascript

node.js - 我应该在哪里为 nodejs 应用程序创建目录?

c++ - 我应该在 C++ 中分离 cpp 和 h 文件吗?

c++ - 在多文件项目中正确#include SDL

makefile - 在 makefile 宏中定义变量(定义)

javascript - JSDoc 两次输出相同的变量

javascript - Ajax 调用后 Controller 中的参数为空

php - php 中的表单 javascript 中的验证

javascript - NPM 无法转换 SASS

javascript - 在 Angular 中动态将 src 分配给图像