Launch Week Day 3: Introducing Organization Notifications in Socket.Learn More
Socket
Book a DemoSign in
Socket

postcss-comment

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-comment - npm Package Compare versions

Comparing version
0.1.2
to
1.0.1
+7
.travis.yml
language: node_js
node_js:
- "5"
- "4"
- "0.12"
- "0.11"
- "iojs"
<!-- LATEST 7a6338a -->
## [v1.0.1](https://github.com/zoubin/postcss-comment/commit/7a6338a) (2015-11-19)
* [ 2015-11-19 [841bb00](https://github.com/zoubin/postcss-comment/commit/841bb00) ] move postcss to dependencies
* [ 2015-11-19 [9360faa](https://github.com/zoubin/postcss-comment/commit/9360faa) ] Fix example
* [ 2015-11-19 [9c314c3](https://github.com/zoubin/postcss-comment/commit/9c314c3) ] CHANGELOG
## [v1.0.0](https://github.com/zoubin/postcss-comment/commit/ec8ec69) (2015-11-19)
* [ 2015-11-19 [ffd8348](https://github.com/zoubin/postcss-comment/commit/ffd8348) ] Support both the hooRequire way and the parser way
## [v0.1.2](https://github.com/zoubin/postcss-comment/commit/4d0f59f) (2015-11-05)
* [ 2015-11-05 [079bde1](https://github.com/zoubin/postcss-comment/commit/079bde1) ] fix nested comments
* [ 2015-11-04 [f295f35](https://github.com/zoubin/postcss-comment/commit/f295f35) ] update readme about usage
## [v0.1.1](https://github.com/zoubin/postcss-comment/commit/52d7774) (2015-11-04)
* [ 2015-11-04 [ce85730](https://github.com/zoubin/postcss-comment/commit/ce85730) ] update readme for usage
## [v0.1.0](https://github.com/zoubin/postcss-comment/commit/e5a4cc5) (2015-11-04)
* [ 2015-11-04 [b1c4209](https://github.com/zoubin/postcss-comment/commit/b1c4209) ] hack postcss to support inline comments
* [ 2015-11-04 [7103b6a](https://github.com/zoubin/postcss-comment/commit/7103b6a) ] Initial commit
var Parser = require('postcss/lib/parser')
var tokenizer = require('./lib/tokenize')
Parser.prototype.tokenize = function () {
this.tokens = tokenizer(this.input)
}
module.exports = require('postcss')
var Input = require('postcss/lib/input')
var Parser = require('./parser')
module.exports = function (css, opts) {
var input = new Input(css, opts)
var parser = new Parser(input)
parser.tokenize()
parser.loop()
return parser.root
}
var inherits = require('util').inherits
var Parser = require('postcss/lib/parser')
var tokenizer = require('./tokenize')
inherits(InlineParser, Parser)
module.exports = InlineParser
function InlineParser(input) {
Parser.call(this, input)
}
InlineParser.prototype.tokenize = function() {
this.tokens = tokenizer(this.input)
}
+1
-8

@@ -1,9 +0,2 @@

var Parser = require('postcss/lib/parser')
var tokenizer = require('./lib/tokenize')
exports.parse = require('./lib/parse')
Parser.prototype.tokenize = function () {
this.tokens = tokenizer(this.input)
}
module.exports = require('postcss')

@@ -228,12 +228,7 @@ var SINGLE_QUOTE = 39; // `''

nextLine = line;
nextOffset = offset;
tokens.push(['comment', content,
line, pos - offset,
nextLine, next - nextOffset
line, next - offset
]);
offset = nextOffset;
line = nextLine;
pos = next;

@@ -240,0 +235,0 @@

{
"name": "postcss-comment",
"version": "0.1.2",
"version": "1.0.1",
"description": "Allow postcss to support inline comments",

@@ -24,4 +24,3 @@ "main": "index.js",

"homepage": "https://github.com/zoubin/postcss-comment#readme",
"dependencies": {},
"peerDependencies": {
"dependencies": {
"postcss": "^5.0.10"

@@ -28,0 +27,0 @@ },

# postcss-comment
Allow postcss to support inline comments.
[![npm](https://nodei.co/npm/postcss-comment.png?downloads=true)](https://www.npmjs.org/package/postcss-comment)
[![version](https://img.shields.io/npm/v/postcss-comment.svg)](https://www.npmjs.org/package/postcss-comment)
[![status](https://travis-ci.org/zoubin/postcss-comment.svg?branch=master)](https://travis-ci.org/zoubin/postcss-comment)
[![dependencies](https://david-dm.org/zoubin/postcss-comment.svg)](https://david-dm.org/zoubin/postcss-comment)
[![devDependencies](https://david-dm.org/zoubin/postcss-comment/dev-status.svg)](https://david-dm.org/zoubin/postcss-comment#info=devDependencies)
## Usage
```bash
npm i --save postcss postcss-comment
npm i --save-dev postcss postcss-comment
```
### As parser
```javascript
require('postcss-comment')
var postcss = require('postcss')
var parser = require('postcss-comment')
// or
// var postcss = require('postcss-comment')
var fs = require('fs')
var file = __dirname + '/inline.css'
postcss()
.process(
fs.readFileSync(file, 'utf8'),
{ from: file, parser: parser }
)
.then(function (result) {
console.log(result.css)
})
```
### Hook require
```javascript
require('postcss-comment/hookRequire')
var postcss = require('postcss')
var fs = require('fs')

@@ -33,2 +60,4 @@

## Example
inline.css:

@@ -35,0 +64,0 @@ ```css