如何定制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
最满意答案
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:
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 enteringgulp
into the terminal. From here, add/remove your own gulp plugins at will. Hope this helps.
相关问答
更多-
Gulp-ruby-sass错误:(Gulp-ruby-sass Error :)[2022-07-29]
这是一个棘手的问题。 看起来你正在使用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 ... -
使用Gulp.js和globbing模式修改文件(同一dest)(Modify file in place (same dest) using Gulp.js and a globbing pattern)[2022-01-01]
你怀疑,你这样做太复杂了。 目的地不需要是动态的,因为globed路径也用于dest 。 简单地管道到同一个基本目录,你在src中,在这种情况下,“sass”: gulp.src("sass/**/*.scss") .pipe(sass()) .pipe(gulp.dest("sass")); 如果您的文件没有共同的基础,并且您需要传递一组路径,这已经不够了。 在这种情况下,您需要指定基本选项。 var paths = [ "sass/**/*.scss", "vendor/sass/* ... -
如何使用glob函数?(How to use the glob function?)[2023-06-22]
问题是因为在累积路径长度之前,不会初始化长度。 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 ...
-
全局字符串比较(Glob string comparison)[2023-03-29]
你可以使用正则表达式吗? 因为你可以将模式转换为正则表达式为/\.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 ...