-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparser.js
More file actions
26 lines (18 loc) · 714 Bytes
/
parser.js
File metadata and controls
26 lines (18 loc) · 714 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/** This module will export a function that parses a css file and returns an orderly listing
* of all css rules, for comparison. I fully anticipate adding reusable bits of functionality
* in other functions as the regexes shape up.
*/
var cssrex = require('./cssrex');
function parse(css){
/** Takes the string or stream of a css file, returns an object with an orderly listing
* of all css rules.
*/
if(typeof css != 'string'){ css = css.toString(); }
var out = {};
var charset = css.match(cssrex.charset);
if (charset != null && (charset[1] || charset[2])){
out.charset = charset[1] || charset[2];
}
return out;
}
module.exports = {parse: parse};