You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
			
				
					24 lines
				
				691 B
			
		
		
			
		
	
	
					24 lines
				
				691 B
			| 
								 
											4 years ago
										 
									 | 
							
								var SUPPORTED_COMPACT_BLOCK_MATCHER = /^@media\W/;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								function tidyBlock(values, spaceAfterClosingBrace) {
							 | 
						||
| 
								 | 
							
								  var withoutSpaceAfterClosingBrace;
							 | 
						||
| 
								 | 
							
								  var i;
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  for (i = values.length - 1; i >= 0; i--) {
							 | 
						||
| 
								 | 
							
								    withoutSpaceAfterClosingBrace = !spaceAfterClosingBrace && SUPPORTED_COMPACT_BLOCK_MATCHER.test(values[i][1]);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    values[i][1] = values[i][1]
							 | 
						||
| 
								 | 
							
								      .replace(/\n|\r\n/g, ' ')
							 | 
						||
| 
								 | 
							
								      .replace(/\s+/g, ' ')
							 | 
						||
| 
								 | 
							
								      .replace(/(,|:|\() /g, '$1')
							 | 
						||
| 
								 | 
							
								      .replace(/ \)/g, ')')
							 | 
						||
| 
								 | 
							
								      .replace(/'([a-zA-Z][a-zA-Z\d\-_]+)'/, '$1')
							 | 
						||
| 
								 | 
							
								      .replace(/"([a-zA-Z][a-zA-Z\d\-_]+)"/, '$1')
							 | 
						||
| 
								 | 
							
								      .replace(withoutSpaceAfterClosingBrace ? /\) /g : null, ')');
							 | 
						||
| 
								 | 
							
								  }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  return values;
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								module.exports = tidyBlock;
							 |