{"name":"csscomb-core","version":"2.0.3","description":"Framework for writing postprocessors","dependencies":{"gonzales-pe":"~3.0.0-0","minimatch":"0.2.12","vow":"0.4.4","vow-fs":"0.3.2"},"main":"lib/core.js","maintainers":[{"name":"tonyganch","email":"tonyganch+github@gmail.com"}],"license":"MIT","repository":{"type":"git","url":"https://github.com/csscomb/core"},"gitHead":"c1650d736d09530437d6c8e84a94ceda5bd6dc3c","bugs":{"url":"https://github.com/csscomb/core/issues"},"homepage":"https://github.com/csscomb/core","_id":"csscomb-core@2.0.3","scripts":{},"_shasum":"99e11233c08c58335e0bb5167d300d61418bcebe","_from":".","_npmVersion":"1.5.0-alpha-1","_npmUser":{"name":"tonyganch","email":"tonyganch+github@gmail.com"},"dist":{"shasum":"99e11233c08c58335e0bb5167d300d61418bcebe","tarball":"http://registry-npm.ywwl.com/csscomb-core/download/csscomb-core-2.0.3.tgz","integrity":"sha512-fvpeSbCytdkR26aUfp35D/0bF3onj89/OI+6jY1zxbUDkf+00LS5k6r0P5sEvZ/oZg2x7qAGZPvLLdkc3JZkbw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGd+TnMUwseyVoB1/6BVwEa4IjzmEAknn67WbGst+vCsAiEAotDpHB0zGGiX8Wa9kEV0Xg5EArvkDkWLHicr/jU8Olo="}],"size":25851,"noattachment":false,"key":"/csscomb-core/-/csscomb-core-2.0.3.tgz"},"readme":"# CSScomb Core\n\nCSScomb Core is a framework for writing postprocessors.  \nIt provides you with a nice set of features:\n\n1. Parser with support of preprocessors\n1. API to create and use options\n1. API to process files and directories\n\n\n## Usage\n\n```js\nvar Comb = require('csscomb-core');\n// Constructor accepts a list of options to use and list of acceptable syntaxes.\nvar comb = new Comb(options, 'css');\n```\n\nFor a simple example of usage take a look\n[at a template project](https://github.com/csscomb/core-template).  \nFeel free to fork it and modify.\n\n## List of public methods\n\nThere are a number of methods that become available once you create an instance.\n\n### comb.use(option)\n\nUse a plugin.\n\n- Params: *{Object}*  Option's plugin\n- Return: *{CombCore}*  Instance's object\n\n### comb.configure(config)\n\nLoad configuration from JSON.  \nActivate and configure needed options.\n\n- Params: *{Object}*  Config\n- Return: *{CombCore}*  Instance's object\n\n### comb.getOptionsOrder()\n\nGet list of available options in exact order they will be processed.  \nCan be used for testing purpose.\n\n- Return: *{Array}*  List of options' names\n\n### comb.getValue(optionName)\n\nGet option's value.  \nCan be used inside plugin's `process` method.\n\n- Params: *{String}*  Option's name\n- Return: Value set by user for this option\n\n### comb.getSyntax()\n\nGet name of syntax that is currently being used.  \nCan be used inside plugin's `process` method.\n\n- Return: *{String}*  Syntax name\n\n### comb.lintPath(path)\n\nLint a file or a directory.\n\n- Params: *{String}*  Path to file or directory</td>\n- Return: *{Promise}*\n\n### comb.lintDirectory(path)\n\nLint all files in a directory.\n\n- Params: *{String}*  Path to file or directory</td>\n- Return: *{Promise}*\n\n### comb.lintFile(path)\n\nLint a single file.\n\n- Params: *{String}*  Path to file\n- Return: *{Promise}*\n\n### comb.lintString(string, options)\n\nLint a string.\n\n- Params:  \n  *{String}*  Code to process  \n  *{{context: String, filename: String, syntax: String}}* Options (optional)\n  where *context* is\n  Gonzales PE rule, *filename* is a file's name that is used to display errors and\n  *syntax* is syntax name with `css` being a default value.  \n- Return: *{Promise<Array>}*  Resolves with list of found errors.  \n\n### comb.processPath(path)\n\nProcess a file or a directory.\n\n- Params: *{String}*  Path to file or directory</td>\n- Return: *{Promise}*\n\n### comb.processDirectory(path)\n\nProcess all files in a directory.\n\n- Params: *{String}*  Path to directory\n- Return: *{Promise}*\n\n### comb.processFile(path)\n\nProcess a single file.\n\n- Params: *{String}*  Path to file\n- Return: *{Promise}*\n\n### comb.processString(string, options)\n\nProcess a string.\n\n- Params:  \n  *{String}*  Code to process  \n  *{{context: String, filename: String, syntax: String}}* Options (optional)\n  where *context* is\n  Gonzales PE rule, *filename* is a file's name that is used to display errors and\n  *syntax* is syntax name with `css` being a default value.  \n- Return: *{Promise<string>}*  Resolves with processed string.  \n\n## Writing a plugin\n\nA plugin is a JavaScript object that has methods to set value and process AST\nnodes.  \nTake a look at [Flip Comb](https://github.com/csscomb/core-template/blob/master/lib/options/flip-comments.js) for an example.  \nThere are some fields you should take care of.\n\n### name\n\nOption's name as it should be used in config.\n\n- Required: yes\n- Acceptable value: *{String}*\n- Example: `\"flip-comments\"`\n\n### syntax\n\nList of syntaxes the option supports.  \nThis depends on parser possibilities.  \nCurrently the following work fine: `css`, `less`, `sass` and `scss`.\n\n- Required: yes\n- Acceptable value: *{Array}*\n- Example: `['css']`\n\n### accepts\n\nIn order to tell CSScomb Core which values are acceptable, plugin should have\neither `accepts` or `setValue` field.  \n`accepts` should be used to provide patterns, while `setValue` is good for\nmodifying value before using it.\n\nYou can use one or several of the following:  \n– `boolean: [true]`  \n– `boolean: [false]`  \n– `boolean: [true, false]`  \n– `string: /regexp/`  \n– `number: true`\n\n- Required: no, but if this field is missed, `setValue` must be set\n- Acceptable value: *{Object}*\n- Example: `{ boolean: [true] }`\n\n### setValue\n\nFunction to modify option's value before using it.  \nThis field overrides `accepts` field if it's set in the plugin too.\n\n- Required: no, but if this field is missed, `accepts` must be set\n- Acceptable value: *{Function}*\n- Example: ` function(value) { return value * 4; }`\n\n### runBefore\n\nRun the plugin before another option.  \n\n- Required: no\n- Acceptable value: *{String}* Another option's name\n- Example: `\"block-indent\"`\n\n### process\n\nModify AST nodes.\n\n- Required: yes\n- Acceptable value: *{Function}*\n- Example: <pre><code>function(nodeType, nodeContent) {\n        if (nodeType === 'commentML') node[0] = ' (╯°□°）╯︵ ┻━┻ ';\n}</code></pre>\n","publish_time":1411295529421,"_cnpm_publish_time":1411295529421,"dist-tags":{"latest":"3.0.6"}}