UNPKG

canonical

Version:

Canonical code style linter and formatter for JavaScript, SCSS and CSS.

76 lines (75 loc) 6.25 kB
{ "_args": [ [ "gonzales-pe@https://registry.npmjs.org/gonzales-pe/-/gonzales-pe-3.0.0-31.tgz", "/Users/gajus/Documents/dev/canonical-code-style/canonical" ] ], "_from": "gonzales-pe@3.0.0-31", "_id": "gonzales-pe@3.0.0-31", "_inCache": true, "_location": "/gonzales-pe", "_phantomChildren": {}, "_requested": { "name": "gonzales-pe", "raw": "gonzales-pe@https://registry.npmjs.org/gonzales-pe/-/gonzales-pe-3.0.0-31.tgz", "rawSpec": "https://registry.npmjs.org/gonzales-pe/-/gonzales-pe-3.0.0-31.tgz", "scope": null, "spec": "https://registry.npmjs.org/gonzales-pe/-/gonzales-pe-3.0.0-31.tgz", "type": "remote" }, "_requiredBy": [ "/css-lint" ], "_resolved": "https://registry.npmjs.org/gonzales-pe/-/gonzales-pe-3.0.0-31.tgz", "_shasum": "dc30d9dc607cb848518fa673b4e4ca1583db2552", "_shrinkwrap": null, "_spec": "gonzales-pe@https://registry.npmjs.org/gonzales-pe/-/gonzales-pe-3.0.0-31.tgz", "_where": "/Users/gajus/Documents/dev/canonical-code-style/canonical", "author": { "email": "tonyganch+github@gmail.com", "name": "Tony Ganch", "url": "http://tonyganch.com" }, "bin": { "gonzales": "./bin/gonzales.js" }, "bugs": { "url": "http://github.com/tonyganch/gonzales-pe/issues" }, "dependencies": { "minimist": "1.1.x" }, "description": "Gonzales Preprocessor Edition (fast CSS parser)", "devDependencies": { "babel": "^5.5.3", "coffee-script": "~1.7.1", "jshint": "2.3.0", "mocha": "2.2.x" }, "engines": { "node": ">=0.6.0" }, "files": [ "bin", "lib" ], "homepage": "http://github.com/tonyganch/gonzales-pe", "license": "MIT", "main": "./lib/gonzales", "name": "gonzales-pe", "optionalDependencies": {}, "readme": "## API\n\n### gonzales.createNode(options)\n\nCreates a new node.\n\nParameters:\n\n* `{{type: String, content: String|Array}} options`\n\nReturns:\n\n* `{Object} node`\n\nExample:\n```js\n var css = 'a {color: tomato}';\n var ast = gonzales.parse(css);\n var node = gonzales.createNode({ type: 'animal', content: 'panda' });\n ast.content.push(node);\n```\n\n### gonzales.parse(css, options)\n\nParse CSS.\n\nParameters:\n\n* `{String} css`\n* `{{syntax: String, rule: String}} options`\n\nReturns:\n\n* `{Object} ast`.\n\nExample:\n```js\n var css = 'a {color: tomato}';\n var ast = gonzales.parse(css);\n```\n\nExample:\n```js\n var less = 'a {$color: tomato}';\n var ast = gonzales.parse(less, {syntax: 'less'});\n```\n\nExample:\n```js\n var less = '$color: tomato';\n var ast = gonzales.parse(less, {syntax: 'less', rule: 'declaration'});\n```\n\n### ast.contains(type)\n\nChecks whether there is a child node of given type.\n\nParameters:\n\n* `{String} type`\n\nReturns:\n\n* `{Boolean}`\n\nExample:\n```js\n if (ast.contains('panda'))\n doSomething();\n```\n\n### ast.content\n\n### ast.eachFor(type, callback)\n\n### ast.end\n\n### ast.first(type)\n\nReturns the first child node of given type.\n\nParameters:\n\n* `{String=} type`\n\nReturns:\n\n* `{Node} node`\n\nExample:\n```js\n var node = ast.first();\n node.content = 'panda';\n```\n\nExample:\n```js\n var node = ast.first('commentML');\n node.content = 'panda';\n```\n\n### ast.forEach(type, function)\n\nCalls the function for every child node of given type.\n\nParameters:\n\n* `{String=} type`\n* `{Function} function`\n\nExample:\n```js\n ast.forEach('commentML', function(node) {\n node.content = 'panda';\n });\n```\n\n### ast.get(index)\n\n### ast.indexHasChanged\n\n### ast.insert(index, node)\n\n### ast.is(type)\n\nChecks whether the node is of given type.\n\nParameters:\n\n* `{String} type`\n\nReturns:\n\n* `{Boolean}`\n\nExample:\n```js\n if (ast.is('s'))\n ast.content = '';\n```\n\n### ast.last(type)\n\nReturns the last child node of given type.\n\nParameters:\n\n* `{String=} type`\n\nReturns:\n\n* `{Node} node`\n\nExample:\n```js\n var node = ast.last()\n node.content = 'panda';\n```\n\nExample:\n```js\n var node = ast.last('commentML');\n node.content = 'panda';\n```\n\n### ast.length\n\n### ast.remove(index)\n\n### ast.start\n\n### ast.syntax\n\n### ast.toJson()\n\n### ast.toString()\n\nConverts AST to code.\n\nParameters:\n\n* `{String} syntax`\n\nReturns:\n\n* `{String} css`\n\nExample:\n```js\n var css = ast.toCSS('css');\n var less = ast.toCSS('less');\n```\n\n### ast.traverse(function)\n\nCalls the function for every node in a tree. Modifies the tree!\n\nParameters:\n\n* `{Function} function`\n\nExample:\n```js\n ast.map(function(node) {\n if (node.type === 'commentML') node.content = 'panda';\n });\n```\n\n### ast.traverseByType(type, callback)\n\n### ast.traverseByTypes(types, callback)\n\n### ast.type\n\n\n## Test\n\nTo run tests:\n\n npm test\n\nThis command will build library files from sources and run tests on all files\nin syntax directories.\n\nEvery test has 3 files: source stylesheet, expected AST and expected string\ncompiled back from AST to css.\n\nIf some tests fail, you can find information in test logs:\n\n- `log/test.log` contains all information from stdout;\n- `log/expected.txt` contains only expected text;\n- `log/result.txt` contains only result text.\n\nThe last two are made for your convenience: you can use any diff app to see\nthe defference between them.\n\nIf you want to test one specific string or get a general idea of how Gonzales\nworks, you can use `test/ast.js` file. \nSimply change the first two strings (`css` and `syntax` vars) and run:\n\n node test/single-test.js\n\n## Report\n\nIf you find a bug or want to add a feature, welcome to [Issues](https://github.com/tonyganch/gonzales-pe/issues).\n\nIf you are shy but have a question, feel free to [drop me a\nline](mailto:tonyganch+gonzales@gmail.com).\n", "readmeFilename": "README.md", "repository": { "type": "git", "url": "git+ssh://git@github.com/tonyganch/gonzales-pe.git" }, "scripts": { "autofix-tests": "./scripts/build.sh && ./scripts/autofix-tests.sh", "build": "./scripts/build.sh", "log": "./scripts/log.sh", "test": "./scripts/build.sh && ./scripts/test.sh" }, "version": "3.0.0-31" }