• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

crissdev/gulp-yaml: A Gulp plugin to convert YAML to JSON

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

crissdev/gulp-yaml

开源软件地址(OpenSource Url):

https://github.com/crissdev/gulp-yaml

开源编程语言(OpenSource Language):

JavaScript 100.0%

开源软件介绍(OpenSource Introduction):

gulp-yaml

JavaScript Style Guide npm version Build Status Build status Dependency Status

A Gulp plugin to convert YAML to JSON using js-yaml.

Install

npm install gulp-yaml --save-dev

Usage

const yaml = require('gulp-yaml');

gulp.src('./src/*.yml')
  .pipe(yaml({ schema: 'DEFAULT_SAFE_SCHEMA' }))
  .pipe(gulp.dest('./dist/'))

gulp.src('./src/*.yml')
  .pipe(yaml({ space: 2 }))
  .pipe(gulp.dest('./dist/'))

gulp.src('./src/*.yml')
  .pipe(yaml({ safe: true }))
  .pipe(gulp.dest('./dist/'))

API

yaml([options])

options.safe

Type: Boolean

Default: true

Enable or disable support for regexps, functions and undefined.

This flag should always be enabled when working with untrusted data.

When this flag is enabled then safeLoad method is used, otherwise load.

options.space

Type: Number or String

Default: null

Control spacing in the resulting output. It has the same usage as for JSON.stringify

options.replacer

Type: Function or Array

Default: null

Further transform the resulting output. It has the same usage as for JSON.stringify

options.schema

Type: String

Default: DEFAULT_SAFE_SCHEMA or DEFAULT_FULL_SCHEMA

Specifies what schema to use. Valid values are the same that js-yaml supports, except they are received as strings (lowercase or uppercase). See the example in the Usage section of this README. The default schema is chosen using the safe option.

options.filename

Type: String

Default: the path of the file processed

String to be used as a file path in error/warning messages.

options.ext

Type: String

Default: .json

File extension of the generated file.

options.json

Type: Boolean

Default: false

Compatibility with JSON.parse behaviour. If true, then duplicate keys in a mapping will override values rather than throwing an error.

options.onWarning

Type: Function

Default: null

Function to call on warning messages. Loader will throw on warnings if this function is not provided.

License

MIT © Cristian Trifan




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
justin713/gulp-premailer: Premailer for gulp发布时间:2022-06-21
下一篇:
gaowhen/task-master: gulp task collection发布时间:2022-06-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap