Open swagger-initializer.js in your text editor and replace "" with the URL for your OpenAPI 3.0 spec.Copy the contents of the /dist folder to your server.The folder /dist includes all the HTML, CSS and JS files needed to run SwaggerUI on a static website or CMS, without requiring NPM. Once swagger-ui has successfully generated the /dist directory, you can copy this to your own file system and host from there. See unpkg's main page for more information on how to use unpkg. Using StandalonePreset will render TopBar and ValidatorBadge as well. Based on project statistics from the GitHub repository for the npm package fontfaceobserver, we found that it has been starred 4,102 times. As such, we scored fontfaceobserver popularity level to be Influential project. You can embed Swagger UI's code directly in your HTML by using unpkg's interface: The npm package fontfaceobserver receives a total of 492,089 downloads a week. This will serve Swagger UI at /swagger instead of /.įor more information on controlling Swagger UI through the Docker image, see the Docker section of the Configuration documentation. The base URL of the web application can be changed by specifying the BASE_URL environment variable: docker run -p 80:8080 -e BASE_URL=/swagger -e SWAGGER_JSON=/foo/swagger.json -v /bar:/foo swaggerapi/swagger-ui You can also provide a URL to a swagger.json on an external host: docker run -p 80:8080 -e SWAGGER_JSON_URL= swaggerapi/swagger-ui Or you can provide your own swagger.json on your host docker run -p 80:8080 -e SWAGGER_JSON=/foo/swagger.json -v /bar:/foo swaggerapi/swagger-ui Will start nginx with Swagger UI on port 80. You can pull a pre-built docker image of the swagger-ui directly from Docker Hub: docker pull swaggerapi/swagger-uiĭocker run -p 80:8080 swaggerapi/swagger-ui SwaggerUIBundle is equivalent to SwaggerUI. SwaggerUIBundle.SwaggerUIStandalonePreset You could do something like this: var SwaggerUIBundle = require('swagger-ui-dist').SwaggerUIBundle If you're in a JavaScript project that can't handle a traditional npm module, The module also exports SwaggerUIBundle and SwaggerUIStandalonePreset, so The folder also has an index.html asset, to make it easy to serve Swagger UI like so: const express = require('express')Ĭonst pathToSwaggerUi = require('swagger-ui-dist').absolutePath() The most useful file is swagger-ui-bundle.js, which is a build of Swagger UI that includes all the code it needs to run in one file. The module's contents mirror the dist folder you see in the Git repository. Will result in more code going across the wire. Note: we suggest using swagger-ui when your tooling makes it possible, as swagger-ui-dist The module, when imported, includes an absolutePath helper function that returns the absolute filesystem path to where the swagger-ui-dist module is installed. In contrast, swagger-ui-dist is meant for server-side projects that need assets to serve to clients. See the Webpack Getting Started sample for details. Here's an example: import SwaggerUI from 'swagger-ui' column-selector A jQuery table column selector plugin. characterset Manipulate and create character sets. url-template An URI template implementation. promis A small embeddable Promise polyfill. Its main file exports Swagger UI's main function, and the module also includes a namespaced stylesheet at swagger-ui/dist/swagger-ui.css. I’ve created and contributed to several other interesting projects: webfontloader A web font loader that provides font events. Swagger-ui is meant for consumption by JavaScript web projects that include module bundlers, such as Webpack, Browserify, and Rollup. We publish two modules to npm: swagger-ui and swagger-ui-dist. See unpkgs main page for more information on how to use unpkg. Make one observer for each font, // by iterating over the data we already have Object.keys(exampleFontData).Installation Distribution channels NPM Registry You can set up monitoring for a single font family at a time: var font = new FontFaceObserver( 'My Family', , Fonts can be supplied by either a font service such as Google Fonts, Typekit, and Webtype or be self-hosted. Conveniently, the FontFaceObserver script will actually load a font for you when you call it, as long as the font you’re observing is referenced in a font-face declaration in the CSS. Unlike the Web Font Loader Font Face Observer uses scroll events to detect font loads efficiently and with minimum overhead. It does not limit you in any way in where, when, or how you load your webfonts. Font Face Observer is a small font-face loader and monitor (3.5KB minified and 1.3KB gzipped) compatible with any webfont service. It will monitor when a webfont is loaded and notify you. Font Face Observer is a small loader and monitor (3.5KB minified and 1.3KB gzipped) compatible with any webfont service.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |