1- var gonzales = require ( 'gonzales' ) ;
1+ var gonzales = require ( 'gonzales-pe ' ) ;
22var minimatch = require ( 'minimatch' ) ;
33var vow = require ( 'vow' ) ;
44var vfs = require ( 'vow-fs' ) ;
@@ -103,22 +103,23 @@ Comb.prototype = {
103103 /**
104104 * Process file provided with a string.
105105 * @param {String } text
106+ * @param {String } [syntax] Syntax name (e.g. `scss`)
106107 * @param {String } [filename]
107108 */
108- processString : function ( text , filename ) {
109+ processString : function ( text , syntax , filename ) {
109110 if ( ! text ) return text ;
110111 var tree ;
111112 var string = JSON . stringify ;
112113 try {
113- tree = gonzales . srcToCSSP ( text ) ;
114+ tree = gonzales . cssToAST ( { syntax : syntax , css : text } ) ;
114115 } catch ( e ) {
115116 throw new Error ( 'Parsing error at ' + filename + ': ' + e . message ) ;
116117 }
117118 if ( typeof tree === 'undefined' ) {
118119 throw new Error ( 'Undefined tree at ' + filename + ': ' + string ( text ) + ' => ' + string ( tree ) ) ;
119120 }
120121 tree = this . processTree ( tree ) ;
121- return gonzales . csspToSrc ( tree ) ;
122+ return gonzales . astToCSS ( { syntax : syntax , ast : tree } ) ;
122123 } ,
123124
124125 /**
@@ -129,9 +130,11 @@ Comb.prototype = {
129130 */
130131 processFile : function ( path ) {
131132 var _this = this ;
132- if ( this . _shouldProcess ( path ) && path . match ( / \. c s s $ / ) ) {
133+ // TODO: Move extension check into `_shouldProcess` method
134+ if ( this . _shouldProcess ( path ) && path . match ( / \. [ c s s , s c s s ] $ / ) ) {
133135 return vfs . read ( path , 'utf8' ) . then ( function ( data ) {
134- var processedData = _this . processString ( data , path ) ;
136+ var syntax = path . split ( '.' ) . pop ( ) ;
137+ var processedData = _this . processString ( data , syntax , path ) ;
135138 var changed = data !== processedData ;
136139 var lint = _this . _lint ;
137140
0 commit comments