postcss-comment
Advanced tools
| language: node_js | ||
| node_js: | ||
| - "5" | ||
| - "4" | ||
| - "0.12" | ||
| - "0.11" | ||
| - "iojs" |
+30
| <!-- 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') | ||
+12
| 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') | ||
+1
-6
@@ -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 @@ |
+2
-3
| { | ||
| "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 @@ }, |
+33
-4
| # postcss-comment | ||
| Allow postcss to support inline comments. | ||
| [](https://www.npmjs.org/package/postcss-comment) | ||
| [](https://www.npmjs.org/package/postcss-comment) | ||
| [](https://travis-ci.org/zoubin/postcss-comment) | ||
| [](https://david-dm.org/zoubin/postcss-comment) | ||
| [](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 |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
13996
26.01%11
83.33%249
7.33%0
-100%93
45.31%+ Added