コード例 #1
0
ファイル: cli.js プロジェクト: nickradford/node-scss-lint
  files.forEach(function(file) {
    filePath = path.resolve(process.cwd(), file);
    logger.log('debug', 'Reading file: %s', filePath);
    try {
      css = fs.readFileSync(filePath, 'utf8');
      logger.log('debug', 'CSS for %s, ', filePath, css);
    } catch (err) {
      logger.error('Couldn\'t read file %s', filePath);
    }

    ast = gonzales.cssToAST(css);
    logger.log('debug', 'AST for %s, ', filePath, ast);
  })
コード例 #2
0
ファイル: csscomb.js プロジェクト: ArllanAndrade/csscomb.js
 processString: function(text, syntax, filename) {
     if (!text) return text;
     var tree;
     var string = JSON.stringify;
     try {
         tree = gonzales.cssToAST({ syntax: syntax, css: text });
     } catch (e) {
         throw new Error('Parsing error at ' + filename + ': ' + e.message);
     }
     if (typeof tree === 'undefined') {
         throw new Error('Undefined tree at ' + filename + ': ' + string(text) + ' => ' + string(tree));
     }
     tree = this.processTree(tree);
     if (this._detect) {
         return this._getDetectedOptions(this._detected);
     } else {
         return gonzales.astToCSS({ syntax: syntax, ast: tree });
     }
 },