New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

doki

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

doki - npm Package Compare versions

Comparing version 0.1.2 to 1.1.2

13

index.js
'use strict';
const fs = require('fs');
const dss = require('dss');
const fs = require('fs');
const dss = require('dss');
const glob = require('glob');

@@ -13,5 +13,5 @@

parse(destFile, options) {
out(options) {
let files;
options || {};
options = options || {};

@@ -34,9 +34,10 @@ if (Array.isArray(this.files)) {

this.parsedArray.push(parsedObject.blocks[0]);
fs.writeFileSync(destFile, JSON.stringify(this.parsedArray));
});
});
return this.parsedArray;
}
parser(name, cb) {
dss.parser(name, ( i, line, block ) => cb(i, line, block));
dss.parser(name, (i, line, block) => cb(i, line, block));
}

@@ -43,0 +44,0 @@ }

{
"name": "doki",
"version": "0.1.2",
"description": "Generates a JSON with your styleguide's data",
"version": "1.1.2",
"description": "Generates your styleguide's data from CSS comments",
"license": "MIT",

@@ -14,7 +14,19 @@ "repository": "filiplinhares/doki",

],
"keywords": ["styleguide", "generator"],
"keywords": [
"styleguide",
"generator"
],
"dependencies": {
"dss": "^1.0.4",
"glob": "^5.0.15"
},
"scripts": {
"test": "xo"
},
"xo": {
"space": true
},
"devDependencies": {
"xo": "^0.13.0"
}
}
<div align="center">
<img src="images/logo.png" alt="doki's logo" >
<p>Generate a JSON with your styleguide's data<p>
</div>
[![Build Status](https://travis-ci.org/filipelinhares/doki.svg?branch=master)](https://travis-ci.org/filipelinhares/doki)
## Installation

@@ -13,26 +15,25 @@ ```sh

const Doki = require('doki');
let doki = new Doki('my-css-files/*.scss');
doki.parse('docs/styles.json');
let output = doki.out();
```
**Your .scss file**
```scss
//
// @name Button
// @description Your standard form button.
//
// @state :hover - Highlights when hovering.
// @state :disabled - Dims the button when disabled.
// @state .primary - Indicates button is the primary action.
// @state .smaller - A smaller button
//
// @markup
// <button>This is a button</button>
//
**Your `.css` file**
```css
/**
* @name Button
* @description Your standard form button.
*
* @state :hover - Highlights when hovering.
* @state :disabled - Dims the button when disabled.
* @state .primary - Indicates button is the primary action.
* @state .smaller - A smaller button
*
* @markup
* <button>This is a button</button>
*/
```
**output JSON`**
```json
{
**output**
```js
[{
"name": "Button",

@@ -66,5 +67,4 @@ "description": "Your standard form button.",

}
}
}]
```
> Multiples files will generate a array of objects.

@@ -79,23 +79,21 @@ ## Doki API

const Doki = require('doki');
var doki = new Doki('css/*.css');
let doki = new Doki('css/*.css');
```
#### doki.parse(outputFile, [options]())
Generate a new JSON.
#### doki.out([options])
- `options` = `{}`
- return `Array`
```js
var doki = new Doki('css/*.css');
doki.parse('output-file');
let doki = new Doki('css/*.css');
let output = doki.out();
```
#### doki.parser(name, cb(i, line, block))
[DSS](https://github.com/DSSWG/DSS#dssparser-name-callback-), by default, includes 4 parsers for the name, description, state and markup of a comment block. You can add to, or override, these defaults by registering a new parser.
[DSS](https://github.com/DSSWG/DSS#dssparser-name-callback-), by default, includes 4 parsers for the `name`, `description`, `state` and `markup` of a comment block. You can add to, or override, these defaults by registering a new `parser`.
```js
var doki = new Doki('css/*.css');
let doki = new Doki('css/*.css');
doki.parser('name', (i, line, block) => line );
doki.parse('output-file');
let output = doki.out('output-file');
```

@@ -105,18 +103,20 @@

#### @name
#### `@name`
```css
// @name Button
/* @name Button */
```
#### @description
#### `@description`
```css
// @description Your standard form button.
/* @description Your standard form button. */
```
#### @state
#### `@state`
```css
// @state :hover - Highlights when hovering.
/* @state :hover - Highlights when hovering. */
```
#### @markup
#### `@markup`
```css
// @markup
// <button>This is a button</button>
/**
* @markup
* <button>This is a button</button>
*/
```

@@ -123,0 +123,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc