如何修改StrongLoop的LoopBack Explorer CSS [英] How to Modify the StrongLoop's LoopBack Explorer CSS
问题描述
我们正在将Strongloop的LoopBack用于REST API,并希望修改LoopBack Explorer的CSS.但是,尚不清楚正在使用哪些CSS文件(LoopBack与Swagger)以及它们的位置.我找不到与此有关的特定文档.
We're using Strongloop's LoopBack for our REST APIs and would like to modify the CSS for the LoopBack Explorer. However, it's not clear which CSS files are being used (LoopBack vs Swagger) and where they're located. I was not able to find specific documentation for this.
推荐答案
您可以通过options.uiDirs
提供自己的Swagger UI文件版本.
You can provide your own version of Swagger UI files via options.uiDirs
.
-
编辑您的
server/server.js
并将此配置选项添加到资源管理器:
Edit your
server/server.js
and add this config option to the explorer:
app.use(explorer(app, { uiDirs: path.resolve(__dirname, 'explorer') }));
将目录node_modules/loopback-explorer/public/css
复制到server/explorer/css
Copy the directory node_modules/loopback-explorer/public/css
to server/explorer/css
根据需要自定义复制的CSS文件.
Customize the copied CSS files as you need.
您应锁定Loopback-Explorer的专业& ;;您的package.json中的次要版本.较新版本的loopback-explorer可能会更改CSS,在这种情况下,您的自定义设置可能会停止工作.
You should lock loopback-explorer's major & minor version in your package.json. Newer versions of loopback-explorer may change the CSS in which case your customization may stop working.
这篇关于如何修改StrongLoop的LoopBack Explorer CSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!