Skip to content

Update stringify method #94

@skad0

Description

@skad0

API:

/**
 * @param {BemCell[]} decl 
 * @param {Object} opts
 * @param {String} opts.exportType - can be one of 'cjs', 'json5', 'json', 'es6'
 * @param {String} opts.format - v1, v2, enb
 * @returns {String}
*/

Description:

opts.format defines how to format normalized declaration:

  • v1 - export formatted decl for v1 format with blocks field
  • v2 - export formatted decl for v2 format with decl field
  • enb - export formatted decl for enb format with deps field

opts.exportType defines how to wrap stringified declaration:

  • cjs - in commonJS module
  • json5
  • json
  • es6 - export default (not right now)

Returned string is representation of object with fields format and formatted decaration (name is defined by opts.format.

Usage:

Use at save with opts.exportType = 'cjs' by default.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions