{"_id":"mensch","_rev":"3549250","name":"mensch","description":"A decent CSS parser","dist-tags":{"latest":"0.3.4"},"maintainers":[{"name":"bago75","email":""},{"name":"brett","email":""}],"time":{"modified":"2024-09-19T02:39:10.000Z","created":"2013-06-11T23:52:03.153Z","0.3.4":"2019-11-09T18:39:33.232Z","0.3.3":"2016-10-03T22:38:49.936Z","0.3.1":"2013-12-02T03:02:57.451Z","0.3.0":"2013-11-23T17:38:57.793Z","0.2.1":"2013-09-20T20:14:39.145Z","0.2.0":"2013-09-18T21:37:38.911Z","0.1.0":"2013-06-17T18:34:53.935Z","0.0.1":"2013-06-11T23:52:03.153Z"},"users":{},"author":{"name":"Brett Stimmerman","email":"brettstimmerman@gmail.com"},"repository":{"type":"git","url":"git://github.com/brettstimmerman/mensch.git"},"versions":{"0.3.4":{"name":"mensch","description":"A decent CSS parser","version":"0.3.4","main":"index.js","scripts":{"test":"make test"},"repository":{"type":"git","url":"git://github.com/brettstimmerman/mensch.git"},"homepage":"https://github.com/brettstimmerman/mensch","keywords":["css","parser","parsing","stylesheet"],"devDependencies":{"jshint":"*","mocha":"*"},"author":{"name":"Brett Stimmerman","email":"brettstimmerman@gmail.com"},"license":"MIT","gitHead":"1bd9f971261be24219c8c84beb370c0b753f51eb","bugs":{"url":"https://github.com/brettstimmerman/mensch/issues"},"_id":"mensch@0.3.4","_nodeVersion":"12.13.0","_npmVersion":"6.12.0","dist":{"shasum":"770f91b46cb16ea5b204ee735768c3f0c491fecd","size":10144,"noattachment":false,"key":"/mensch/-/mensch-0.3.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/mensch/download/mensch-0.3.4.tgz"},"maintainers":[{"name":"bago75","email":""},{"name":"brett","email":""}],"_npmUser":{"name":"brett","email":"brettstimmerman@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mensch_0.3.4_1573324773083_0.973995509598977"},"_hasShrinkwrap":false,"publish_time":1573324773232,"_cnpm_publish_time":1573324773232,"_cnpmcore_publish_time":"2021-12-16T11:32:12.197Z"},"0.3.3":{"name":"mensch","description":"A decent CSS parser","version":"0.3.3","main":"index.js","scripts":{"test":"make test"},"repository":{"type":"git","url":"git://github.com/brettstimmerman/mensch.git"},"homepage":"https://github.com/brettstimmerman/mensch","keywords":["css","parser","parsing","stylesheet"],"devDependencies":{"jshint":"*","mocha":"*"},"author":{"name":"Brett Stimmerman","email":"brettstimmerman@gmail.com"},"license":"MIT","gitHead":"3c9cc0104984ccbbb6a27255ff36b9934f42e868","bugs":{"url":"https://github.com/brettstimmerman/mensch/issues"},"_id":"mensch@0.3.3","_shasum":"e200ff4dd823717f8e0563b32e3f5481fca262b2","_from":".","_npmVersion":"2.7.4","_nodeVersion":"0.12.2","_npmUser":{"name":"bago75","email":"npm@bago.org"},"dist":{"shasum":"e200ff4dd823717f8e0563b32e3f5481fca262b2","size":10146,"noattachment":false,"key":"/mensch/-/mensch-0.3.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/mensch/download/mensch-0.3.3.tgz"},"maintainers":[{"name":"bago75","email":""},{"name":"brett","email":""}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/mensch-0.3.3.tgz_1475534328172_0.8808043990284204"},"directories":{},"publish_time":1475534329936,"_hasShrinkwrap":false,"_cnpm_publish_time":1475534329936,"_cnpmcore_publish_time":"2021-12-16T11:32:12.422Z"},"0.3.1":{"name":"mensch","description":"A decent CSS parser","version":"0.3.1","main":"index.js","scripts":{"test":"make test"},"repository":{"type":"git","url":"git://github.com/brettstimmerman/mensch.git"},"homepage":"https://github.com/brettstimmerman/mensch","keywords":["css","parser","parsing","stylesheet"],"devDependencies":{"jshint":"*","mocha":"*"},"author":{"name":"Brett Stimmerman","email":"brettstimmerman@gmail.com"},"license":"MIT","readmeFilename":"README.md","bugs":{"url":"https://github.com/brettstimmerman/mensch/issues"},"_id":"mensch@0.3.1","dist":{"shasum":"49aacdb28352d58a972bb2c85813725b55191530","size":9363,"noattachment":false,"key":"/mensch/-/mensch-0.3.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/mensch/download/mensch-0.3.1.tgz"},"_from":".","_npmVersion":"1.3.11","_npmUser":{"name":"brett","email":"brettstimmerman@gmail.com"},"maintainers":[{"name":"bago75","email":""},{"name":"brett","email":""}],"directories":{},"publish_time":1385953377451,"_hasShrinkwrap":false,"_cnpm_publish_time":1385953377451,"_cnpmcore_publish_time":"2021-12-16T11:32:12.628Z"},"0.3.0":{"name":"mensch","description":"A decent CSS parser","version":"0.3.0","main":"index.js","scripts":{"test":"make test"},"repository":{"type":"git","url":"git://github.com/brettstimmerman/mensch.git"},"homepage":"https://github.com/brettstimmerman/mensch","keywords":["css","parser","parsing","stylesheet"],"devDependencies":{"jshint":"*","mocha":"*"},"author":{"name":"Brett Stimmerman","email":"brettstimmerman@gmail.com"},"license":"MIT","readmeFilename":"README.md","_id":"mensch@0.3.0","dist":{"shasum":"f4bb1f1e3f38c66eb4758e7181faa5a07f384fe7","size":9297,"noattachment":false,"key":"/mensch/-/mensch-0.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/mensch/download/mensch-0.3.0.tgz"},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"brett","email":"brettstimmerman@gmail.com"},"maintainers":[{"name":"bago75","email":""},{"name":"brett","email":""}],"directories":{},"publish_time":1385228337793,"_hasShrinkwrap":false,"_cnpm_publish_time":1385228337793,"_cnpmcore_publish_time":"2021-12-16T11:32:12.819Z"},"0.2.1":{"name":"mensch","description":"A decent CSS parser","version":"0.2.1","main":"index.js","scripts":{"test":"make test"},"repository":{"type":"git","url":"git://github.com/brettstimmerman/mensch.git"},"homepage":"https://github.com/brettstimmerman/mensch","keywords":["css","parser","parsing","stylesheet"],"devDependencies":{"jshint":"*","mocha":"*"},"author":{"name":"Brett Stimmerman","email":"brettstimmerman@gmail.com"},"license":"MIT","readmeFilename":"README.md","bugs":{"url":"https://github.com/brettstimmerman/mensch/issues"},"_id":"mensch@0.2.1","dist":{"shasum":"df145486d86a9a962800d0e483b6fbf3f643ad61","size":9079,"noattachment":false,"key":"/mensch/-/mensch-0.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/mensch/download/mensch-0.2.1.tgz"},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"brett","email":"brettstimmerman@gmail.com"},"maintainers":[{"name":"bago75","email":""},{"name":"brett","email":""}],"directories":{},"publish_time":1379708079145,"_hasShrinkwrap":false,"_cnpm_publish_time":1379708079145,"_cnpmcore_publish_time":"2021-12-16T11:32:13.023Z"},"0.2.0":{"name":"mensch","description":"A decent CSS parser","version":"0.2.0","main":"index.js","scripts":{"test":"make test"},"repository":{"type":"git","url":"git://github.com/brettstimmerman/mensch.git"},"homepage":"https://github.com/brettstimmerman/mensch","keywords":["css","parser","parsing","stylesheet"],"devDependencies":{"jshint":"*","mocha":"*"},"author":{"name":"Brett Stimmerman","email":"brettstimmerman@gmail.com"},"license":"MIT","readmeFilename":"README.md","bugs":{"url":"https://github.com/brettstimmerman/mensch/issues"},"_id":"mensch@0.2.0","dist":{"shasum":"7a39e2e090412a1a8d0478b59ddd98a305fe4f7d","size":9035,"noattachment":false,"key":"/mensch/-/mensch-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/mensch/download/mensch-0.2.0.tgz"},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"brett","email":"brettstimmerman@gmail.com"},"maintainers":[{"name":"bago75","email":""},{"name":"brett","email":""}],"directories":{},"publish_time":1379540258911,"_hasShrinkwrap":false,"_cnpm_publish_time":1379540258911,"_cnpmcore_publish_time":"2021-12-16T11:32:13.244Z"},"0.1.0":{"name":"mensch","description":"A decent CSS parser","version":"0.1.0","main":"index.js","scripts":{"test":"make test"},"repository":{"type":"git","url":"git://github.com/brettstimmerman/mensch.git"},"homepage":"https://github.com/brettstimmerman/mensch","keywords":["css","parser","parsing","stylesheet"],"devDependencies":{"jshint":"*","mocha":"*"},"author":{"name":"Brett Stimmerman","email":"brettstimmerman@gmail.com"},"license":"MIT","_id":"mensch@0.1.0","dist":{"shasum":"9ea1329a246f2e6aa965c39f536ede81c73a70d7","size":275337,"noattachment":false,"key":"/mensch/-/mensch-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/mensch/download/mensch-0.1.0.tgz"},"_npmVersion":"1.1.59","_npmUser":{"name":"brett","email":"brettstimmerman@gmail.com"},"maintainers":[{"name":"bago75","email":""},{"name":"brett","email":""}],"directories":{},"publish_time":1371494093935,"_hasShrinkwrap":false,"_cnpm_publish_time":1371494093935,"_cnpmcore_publish_time":"2021-12-16T11:32:14.933Z"},"0.0.1":{"name":"mensch","description":"A decent CSS parser","version":"0.0.1","main":"index.js","scripts":{"test":"make test"},"repository":{"type":"git","url":"git://github.com/brettstimmerman/mensch.git"},"homepage":"https://github.com/brettstimmerman/mensch","keywords":["css","parser","parsing","stylesheet"],"devDependencies":{"jshint":"*","mocha":"*"},"author":{"name":"Brett Stimmerman","email":"brettstimmerman@gmail.com"},"license":"MIT","_id":"mensch@0.0.1","dist":{"shasum":"c2574d7590f7b2d2d2d996a5c5c8e6c9fafedbf9","size":272665,"noattachment":false,"key":"/mensch/-/mensch-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/mensch/download/mensch-0.0.1.tgz"},"_npmVersion":"1.1.59","_npmUser":{"name":"brett","email":"brettstimmerman@gmail.com"},"maintainers":[{"name":"bago75","email":""},{"name":"brett","email":""}],"directories":{},"publish_time":1370994723153,"_hasShrinkwrap":false,"_cnpm_publish_time":1370994723153,"_cnpmcore_publish_time":"2021-12-16T11:32:16.035Z"}},"readme":"# mensch [![Build Status](https://secure.travis-ci.org/brettstimmerman/mensch.png?branch=master)](http://travis-ci.org/brettstimmerman/mensch)\n\nA decent CSS parser.\n\n# usage\n\n```sh\nnpm install mensch\n```\n\n```js\nvar mensch = require('mensch');\n\nvar ast = mensch.parse('p { color: black; }');\nvar css = mensch.stringify(ast);\n\nconsole.log(css);\n// => p { color: black; }\n```\n\n# api\n\n## parse(css, [options={}])\n\nConvert a CSS string or an array of lexical tokens into a `stringify`-able AST.\n\n- `css` {String|Array} CSS string or array of lexical tokens\n- `[options]` {Object}\n- `[options.comments=false]` {Boolean} Allow comment nodes in the AST.\n- `[options.position=false]` {Boolean} Allow line/column position in the AST.\n\nWhen `{position: true}`, AST node will have a `position` property:\n\n```js\n{\n  type: 'comment',\n  text: ' Hello World! ',\n  position: {\n    start: { line: 1, col: 1 },\n    end: { line 1, col: 18 }\n  }\n}\n```\n\n## stringify(ast, [options={}])\n\nConvert a `stringify`-able AST into a CSS string.\n\n- `ast` {Object} A `stringify`-able AST\n- `[options]` {Object}\n- `[options.comments=false]` {Boolean} Allow comments in the stringified CSS.\n- `[options.indentation='']` {String} E.g., `indentation: '  '` will indent by\n    two spaces.\n\n## lex(css)\n\nConvert a CSS string to an array of lexical tokens for use with `.parse()`.\n\n- `css` {String} CSS\n\n# non-validating\n\nMensch is a non-validating CSS parser. While it can handle the major language\nconstructs just fine, and it can recover from gaffes like mis-matched braces and\nmissing or extraneous semi-colons, mensch can't tell you when it finds\ninvalid CSS like a misspelled property name or a misplaced `@import`.\n\n# comments\n\nUnlike most CSS parsers, mensch allows comments to be represented in the AST and\nsubsequently stringified with the `{comments: true}` option.\n\n```js\nvar options = { comments: true };\n```\n\n```js\nvar ast = mensch.parse('.red { color: red; /* Natch. */ }', options);\nvar css = mensch.stringify(ast, options);\n\nconsole.log(css);\n//=> .red { color: red; /* Natch. */ }\n```\n\nHowever, comments within the context of a selector, property, etc., will be\nignored. These comments are difficult to represent in the AST.\n\n```js\nvar ast = mench.parse('.red /*1*/ { color /*2*/: /*3*/ red /*4*/; }', options);\nvar css = mesch.stringify(ast, options);\n\nconsole.log(css);\n//=> .red { color: red; }\n```\n\n# ast\n\nThe structure of mensch's AST riffs on several existing CSS parsers, but it\nmight not be 100% compatible with other CSS parsers. Here it is in a nutshell:\n\n```js\n{\n  type: 'stylesheet'\n  stylesheet: {\n    rules: [{\n      type: 'rule',\n      selectors: ['.foo'],\n      declarations: [{\n        type: 'property',\n        name: 'color',\n        value: 'black'\n      }]\n    }]\n  }\n}\n```\n\n# credits\n\nMensch is based on several existing CSS parsers, but\n[nzakas/parser-lib](https://github.com/nzakas/parser-lib) and\n[visionmedia/css](https://github.com/visionmedia/css) are notable influences.\n\n# known users\n\n[voidlabs/mosaico](https://github.com/voidlabs/mosaico) uses Mensch parser to parse custom-flavored CSS rules in email templates and make the template editable: positions, comment parsing, multiple declarations for the same property have been keys to the choice of Mensch!\n\n[Automattic/juice](https://github.com/Automattic/juice) moved to Mensch CSS parser since 3.0 release in order to fix dozen of issues with the previous parser, expecially with support for \"multiple properties declarations\" in the same ruleset and with invalid values.\n\nPlease let us know if you use Mensch in your library!\n","_attachments":{},"homepage":"https://github.com/brettstimmerman/mensch","bugs":{"url":"https://github.com/brettstimmerman/mensch/issues"},"license":"MIT"}