首页 \ 问答 \ 如何定制swagger-ui?(How to customize swagger-ui?)

如何定制swagger-ui?(How to customize swagger-ui?)

我正在学习招摇,尝试做一些改变,看看它是否可以在索引页面上反映出来。 所以起点是index.html页面,我从jar文件中复制了它:

C:\招摇的UI \目标\招摇-UI-2.1.0-M1 \ WEB-INF \ lib中\招摇-UI-2.1.8-M1.jar

并将新页面保存为index2.html,在里面的html内容中添加了一行,并将其添加到上面的jar文件中。

但是我注意到它有原始index.html文件的.gz文件,不知道它的用途,所以我还创建了一个名为index2.html.gz的文件并将其添加到上面的jar文件中,然后运行jetty服务器,并加载index.html: http:// localhost:8080 / swagger-ui / webjars / swagger-ui / 2.1.8-M1 / index.html

它显示没问题,然后我尝试加载:index2.html,但它找不到页面,为什么? 我应该将它包含在哪里,以便显示在: http:// localhost:8080 / swagger-ui / webjars / swagger-ui / 2.1.8-M1 / index2.html

错误消息是:

HTTP错误404

访问/swagger-ui/webjars/swagger-ui/2.1.8-M1/index2.html时遇到问题。 原因:

Not Found

I'm learning swagger, trying to make a little change and see if it can be reflected on index page. So the starting point is the index.html page, I made a copy of it from the jar file :

C:\swagger-ui\target\swagger-ui-2.1.0-M1\WEB-INF\lib\swagger-ui-2.1.8-M1.jar

and saved the new page as index2.html, added a line to the html content inside, and added it to the above jar file.

But I've noticed it has a .gz file for the original index.html file, don't know its purpose, so I also made a file called index2.html.gz and added it to the above jar file, then run the jetty server, and loaded the index.html : http://localhost:8080/swagger-ui/webjars/swagger-ui/2.1.8-M1/index.html

It showed up alright, then I tried to load : index2.html, but it couldn't find the page, why ? Where should I include it so it will show up at : http://localhost:8080/swagger-ui/webjars/swagger-ui/2.1.8-M1/index2.html

The error message is :

HTTP ERROR 404

Problem accessing /swagger-ui/webjars/swagger-ui/2.1.8-M1/index2.html. Reason:

Not Found

原文:https://stackoverflow.com/questions/31568602
更新时间:2022-03-17 15:03

最满意答案

gulp抛出的错误与post-css npm模块有关。 既然你在使用sass,我不确定为什么会出现这种情况。 尝试删除它并发布你的package.json文件。

根据文档,你不希望根据gulp-ruby-sass在第一个声明中使用pipe 。 试试这个:

// Styles Task
gulp.task('styles', function () {
    return sass(paths.sassSrcPath, {
            style: 'compressed',
            loadPath: [paths.sassImportsPath]
        })
    .pipe(gulp.dest(paths.sassDestPath));
});

更深入的信息

使用gulp-sass而不是gulp-ruby-sass。 这是一个更快,更好支持的Sass版本,在这个开发周期中。

这是我通常在styles构建任务中使用gulp-sass的方法(基于Yeoman生成器gulp-webapp ):

gulp.task('styles', () => {
  return gulp.src('app/styles/*.scss')
    .pipe($.sourcemaps.init())
    .pipe($.sass.sync({
      outputStyle: 'expanded',
      precision: 10,
      includePaths: ['.']
    }).on('error', $.sass.logError))
    .pipe($.autoprefixer({browsers: ['last 1 version']}))
    .pipe($.sourcemaps.write())
    .pipe(gulp.dest('.tmp/styles'))
    .pipe(reload({stream: true}));
});

它与你的类似,但它输出源代码,当你正在调试压缩代码时它是非常有用的。 你必须添加gulp-sourcemaps到你的package.json才能使它工作。


Although this isn't a direct fix to my initial question, here is how I got the most basic gulp script to work (almost all of the tutorials went above and beyond what I wanted so I had to figure it out myself through trial and error).

Here is my gulp.js file:

var gulp = require('gulp');
var babel = require('gulp-babel');

gulp.task('default', function() {
  return gulp.src('js/dev/main.js')
    .pipe(babel({
      presets: ['es2015']
    }))
    .pipe(gulp.dest('js'));
});

Here is my file structure:

enter image description here

Basically what it's doing is utilizing this gulp babel.js plugin and converting my (ECMA6) javascript in the js/dev/main.js to ECMA5 javascript in the form of a /js/main.js file it creates upon entering gulp into the terminal. From here, add/remove your own gulp plugins at will. Hope this helps.

相关问答

更多
  • 这是一个棘手的问题。 看起来你正在使用generator-gulp-angular和选择的ruby-sass 。 不幸的是, gulp-ruby-sass的API在9月份已经发生了变化(发布了2.0.0版本),而且自那时起生成器没有更新。 简而言之:新API需要传递到流工厂方法的源文件.pipe($.rubySass([**SOURCE FILES HERE**], sassOptions)).on('error', conf.errorHandler('RubySass'))当构建链与其他插件(如inje ...
  • 你怀疑,你这样做太复杂了。 目的地不需要是动态的,因为globed路径也用于dest 。 简单地管道到同一个基本目录,你在src中,在这种情况下,“sass”: gulp.src("sass/**/*.scss") .pipe(sass()) .pipe(gulp.dest("sass")); 如果您的文件没有共同的基础,并且您需要传递一组路径,这已经不够了。 在这种情况下,您需要指定基本选项。 var paths = [ "sass/**/*.scss", "vendor/sass/* ...
  • 问题是因为在累积路径长度之前,不会初始化长度。 length = 0; <-- should initialize length here for (p = glob_results.gl_pathv, cnt = glob_results.gl_pathc; cnt; p++, cnt--) length += strlen(*p) + 1; 另外,不要转换calloc返回值,并且sizeof(char)在标准中定义为1。 所以最好这样做: gfilename = calloc(length, ...
  • gulp抛出的错误与post-css npm模块有关。 既然你在使用sass,我不确定为什么会出现这种情况。 尝试删除它并发布你的package.json文件。 根据文档,你不希望根据gulp-ruby-sass在第一个声明中使用pipe 。 试试这个: // Styles Task gulp.task('styles', function () { return sass(paths.sassSrcPath, { style: 'compressed', ...
  • gulp.watch的第二个参数应该是一个数组或一个函数,而不是(如你的情况下)一个字符串。 所以请改用: gulp.watch(JADE_SRC, [ JADE_TASK ]); The second argument to gulp.watch should either be an array or a function, not (as in your case) a string. So use this instead: gulp.watch(JADE_SRC, [ JADE_TASK ]); ...
  • 我忘了包含“指南针:真实”,这似乎使得需要参数起作用。 完整的工作代码是: gulp.task('sass', function () { gulp.src('./assets/_dev/stylesheets/scss/**/*.scss') .pipe(sass({ noCache: true, style: "expanded", lineNumbers: true, compass: true, require ...
  • ]字符结束字符列表。 所以[[]是一个只包含[ 。 [[]的字符列表。 空字符列表没有意义,因此作为例外,将]直接放在开头[ ( []...] )后面可以用来在列表中包含]字符。 但这是唯一的例外。 (出于类似的原因, -作为文字字符必须是列表中的最后一个字符。) The ] character ends a character list. So [[] is a character list that contains only [. An empty character list would not m ...
  • 改变这个: return del([buildStyleDir, {force: true}], cb); 至 return del([buildStyleDir], {force: true}, cb); 注意关闭数组括号位置 - 仅在glob周围。 Change this: return del([buildStyleDir, {force: true}], cb); to return del([buildStyleDir], {force: true}, cb); Note the clos ...
  • 我特别不了解吞咽情况,但由于它似乎是一个npm模块,您可以使用电子应用程序在本地安装它。 在终端cd到你的electron/resources/app文件夹并运行 npm install gulp-cli -g npm install gulp -D (如https://gulpjs.com/所示) 然后您应该在同一个目录中看到一个node_modules文件夹,其中包含安装node_modules 。 然后可以像其他电子应用程序一样打包。 I don't know about gulp in parti ...
  • 你可以使用正则表达式吗? 因为你可以将模式转换为正则表达式为/\.s[ac]ss$/i ,然后执行 path.forEach(file => { if (file.match(pattern)) { } }); 还有glob-to-regexp ,如果你必须在glob中编写模式。 Can you use regex? Because you could convert the pattern to regex as /\.s[ac]ss$/i, and then do path.forEach(f ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。