mirror of https://github.com/ElemeFE/element
				
				
				
			
		
			
				
	
	
		
			21 lines
		
	
	
		
			572 B
		
	
	
	
		
			JavaScript
		
	
	
			
		
		
	
	
			21 lines
		
	
	
		
			572 B
		
	
	
	
		
			JavaScript
		
	
	
'use strict';
 | 
						|
 | 
						|
var postcss = require('postcss');
 | 
						|
var fs = require('fs');
 | 
						|
var path = require('path');
 | 
						|
var fontFile = fs.readFileSync(path.resolve(__dirname, '../packages/theme-default/src/icon.css'), 'utf8');
 | 
						|
var nodes = postcss.parse(fontFile).nodes;
 | 
						|
var classList = [];
 | 
						|
 | 
						|
nodes.forEach((node) => {
 | 
						|
  var selector = node.selector || '';
 | 
						|
  var reg = new RegExp(/\.el-icon-([^:]+):before/);
 | 
						|
  var arr = selector.match(reg);
 | 
						|
 | 
						|
  if (arr && arr[1]) {
 | 
						|
    classList.push(arr[1]);
 | 
						|
  }
 | 
						|
})
 | 
						|
 | 
						|
fs.writeFile(path.resolve(__dirname, '../examples/icon.json'), JSON.stringify(classList));
 |