如何构建 Slick-carousel

how to build Slick-carousel

我正在尝试构建 Ken Wheeler 的 slick-carousel 的分支。

该项目很旧,这意味着它的构建设置与我们最近看到的大多数项目不同。

与构建相关的文件(您可以在上面的 Github 链接中查找更多信息)

Makefile:

build: components slick.js slick.css
    @component build --dev

components: component.json
    @component install --dev

.PHONY: clean

component.json:

{
    "name": "slick",
    "repo": "kenwheeler/slick",
    "description": "the last carousel you'll ever need",
    "version": "1.8.1",
    "keywords": ["ui", "jquery", "carousel", "responsive", "slider"],
    "dependencies": {
        "component/jquery": "*"
    },
    "development": {},
    "scripts": {
        "slick/slick.js": "slick.js"
    },
    "styles": {
        "slick/slick.css": "slick.css",
        "slick/slick-theme.css": "slick-theme.css"
    }
}

到目前为止,我能够弄清楚我需要 componentjs 构建工具。

注意: 当前版本为 1.x 但 slick 的 component.json 语法仅适用于版本 0.x.

npm install -g component@0

然后我尝试 运行 make 构建:

make: *** No rule to make target `slick.js', needed by `build'. Stop.

我不确定那是什么意思,我读过我的 make 版本可能与最初用于构建 lib 的版本不兼容;但我没有看到任何可以帮助我找到合适的 make 版本的元数据。

有人可以帮忙吗?

确保 slick.js 在同一目录中。另请注意 Slick.js 不等于 slick.js(区分大小写)。

此外,我在尝试构建具有类似错误的分支时发现了此线程。虽然它是关于一个不同的项目,但它可能会有所帮助。看看:https://github.com/kubernetes/kubernetes/issues/28987

这是另一条信息可能有帮助:

You can't run make config just anywhere - You have to be in a directory which >contains a Make file. To verify:

ls Makefile

This file has to contain a target called config:

grep ^config Makefile

(this last command will not match all possible Makefile syntax, but if it's a >simple file it should at least show you if there is another target like >configure or configuration.)

(You should look at the original post at this adress:https://unix.stackexchange.com/questions/103080/how-do-i-fix-make-no-rule-to-make-target-config)

我想Makefile和componentjs现在用不到了

用浏览器打开index.html即可开发slick。只需将其拖到浏览器选项卡或使用浏览器打开 file:///path/to/slick/index.html

我假设如果你想构建 js 文件,你需要做的就是编辑 slick/slick.js 并将其缩小为 slick/slick.min.js。然后提出拉取请求。
因为slick.js是开箱即用的UMD风格,所以只需要做minify即可。