Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/utils/trimLine.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict'

var urlOrContentRe = /(["'].+["'])|( +|:)url\(.+\)/
var contentRe = /(content:\s*["'])(?:.+)(["'])/
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This regexp creates 2 match groups. The first is the content: " part and the second basically just amounts to the closing quotation mark and possibly semicolon.

var urlRe = /([\S ]+\:\s*url\s*\(["'])(?:.+)(["']\))/
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This regexp matches anything before and after a url expression such as background: url("../images/someimage.png") center center; With that expression it would match background: url(" and ") center center;


/**
* @description separate out line comments
Expand All @@ -17,7 +18,7 @@ var trimLine = function( line ) {
this.cache.comment = ''

// remove urls, content strings
var noUrl = line.replace( urlOrContentRe, ' ' )
var noUrl = line.replace( contentRe, '$1$2' ).replace( urlRe, '$1$2' )

// strip line comments, if any exist after stripping urls
if ( noUrl.indexOf( '//' ) !== -1 ) {
Expand Down