This repository has been archived by the owner on Mar 28, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
53 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,20 @@ | ||
'use strict'; | ||
|
||
module.exports = function postcssCssstats(options) { | ||
options = options || {}; | ||
var _ = require('lodash'); | ||
var postcss = require('postcss'); | ||
var cssstats = require('cssstats'); | ||
|
||
return true; | ||
}; | ||
module.exports = postcss.plugin('cssstats', function(options, callback) { | ||
if (_.isFunction(options)) { | ||
callback = options; | ||
options = {}; | ||
} else { | ||
options = options || {}; | ||
callback = callback || _.noop; | ||
} | ||
|
||
return function(css, postcssResult) { | ||
// XXX TODO: cssstats should also be able to handle an AST | ||
callback(cssstats(css.toString())); | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.foo { | ||
color: tomato; | ||
} | ||
|
||
.bar .baz { | ||
color: hotpink; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,25 @@ | ||
'use strict'; | ||
|
||
var fs = require('fs'); | ||
var assert = require('assert'); | ||
var postcss = require('postcss'); | ||
var isPresent = require('is-present'); | ||
var postcssCssstats = require('..'); | ||
|
||
describe('postcss-cssstats', function() { | ||
|
||
it('should do something awesome', function() { | ||
assert.equal(postcssCssstats(), true); | ||
it('should return a stats object', function(done) { | ||
postcss() | ||
.use(postcssCssstats({}, function(stats) { | ||
assert.ok(isPresent(stats)); | ||
})) | ||
.process(fixture('basic')) | ||
.then(function() { | ||
done(); | ||
}); | ||
}); | ||
}); | ||
|
||
function fixture(name) { | ||
return fs.readFileSync('test/fixtures/' + name + '.css', 'utf8').toString(); | ||
} |