将 npm 用于前端依赖还是我误解了什么?
Using npm for front-end dependecie or am I misunderstanding something?
我使用 Roots/Sage wordpress 入门主题,它使用 npm、gulp 和 bower。
我不想在我的主题中使用 blueimp gallery。
之前我是用bower安装的,但是Bluimp/Gallery的新版本没有bower.json
文件,Blueimp/Gallery的创建者says:
With the latest version of NPM and its support for flat dependency
trees, I don't see the need for bower anymore.
我应该如何在我的主题中安装 Blueimp/Gallery?
我尝试使用 npm install --save blueimp-gallery,但现在 gulp 没有将 Blueimp 的 css 和 js 编译到我的 main.js 和 main.css 中。我还应该使用 bower 吗?
我决定使用 Bower。
编辑了我的 bower.json
文件,因此它也构建了 blueimp/Gallery 的文件:
"overrides": {
"blueimp-gallery": {
"main": [
"css/blueimp-gallery.css",
"css/blueimp-gallery-indicator.css",
"css/blueimp-gallery-video.css",
"img/error.png",
"img/error.svg",
"img/loading.gif",
"img/play-pause.png",
"img/play-pause.svg",
"img/video-play.png",
"img/video-play.svg",
"js/blueimp-helper.js",
"js/blueimp-gallery.js",
"js/blueimp-gallery-fullscreen.js",
"js/blueimp-gallery-indicator.js",
"js/blueimp-gallery-video.js",
"js/blueimp-gallery-vimeo.js",
"js/blueimp-gallery-youtube.js"
]
}
}
我也编辑了我的 gulpfile.js
,因为 Blueimp/Gallery 的 css 正在寻找它在 dist/img
中的图像,但我的 gulp 文件复制了它们到 dist/images
和 dist/fonts
(svg)。所以我将这一行添加到字体和图像 gulp 任务:
.pipe(gulp.dest(path.dist + 'img'))
我使用 Roots/Sage wordpress 入门主题,它使用 npm、gulp 和 bower。
我不想在我的主题中使用 blueimp gallery。
之前我是用bower安装的,但是Bluimp/Gallery的新版本没有bower.json
文件,Blueimp/Gallery的创建者says:
With the latest version of NPM and its support for flat dependency trees, I don't see the need for bower anymore.
我应该如何在我的主题中安装 Blueimp/Gallery? 我尝试使用 npm install --save blueimp-gallery,但现在 gulp 没有将 Blueimp 的 css 和 js 编译到我的 main.js 和 main.css 中。我还应该使用 bower 吗?
我决定使用 Bower。
编辑了我的 bower.json
文件,因此它也构建了 blueimp/Gallery 的文件:
"overrides": {
"blueimp-gallery": {
"main": [
"css/blueimp-gallery.css",
"css/blueimp-gallery-indicator.css",
"css/blueimp-gallery-video.css",
"img/error.png",
"img/error.svg",
"img/loading.gif",
"img/play-pause.png",
"img/play-pause.svg",
"img/video-play.png",
"img/video-play.svg",
"js/blueimp-helper.js",
"js/blueimp-gallery.js",
"js/blueimp-gallery-fullscreen.js",
"js/blueimp-gallery-indicator.js",
"js/blueimp-gallery-video.js",
"js/blueimp-gallery-vimeo.js",
"js/blueimp-gallery-youtube.js"
]
}
}
我也编辑了我的 gulpfile.js
,因为 Blueimp/Gallery 的 css 正在寻找它在 dist/img
中的图像,但我的 gulp 文件复制了它们到 dist/images
和 dist/fonts
(svg)。所以我将这一行添加到字体和图像 gulp 任务:
.pipe(gulp.dest(path.dist + 'img'))