nl_tokens: [ generateImageString description ]
pl_tokens: function ( cssFilePath , fullUrl , imageUrl , options ) { imageUrl = imageUrl . trim ( ) . replace ( rQuotes , "" ) . replace ( rParams , "" ) ; // remove query string/hash parmams in the filename, like foo.png?bar or foo.png#bar // See if this image was already processed before... if ( cache [ imageUrl ] ) { // If we already processed this image, just pull it from the cache. return <mask> [ imageUrl ] ; } else { // If this is a novel image, encode it as a data URI string and then cache it. var loc = imageUrl ; var isLocalFile = ! rData . test ( imageUrl ) && ! rExternal . test ( imageUrl ) ; if ( ! isLocalFile ) { // Ignore non-local image references. return fullUrl ; } else { // local file system.. fix up the path loc = imageUrl . charAt ( 0 ) === "/" ? loc : path . join ( path . dirname ( cssFilePath ) , imageUrl ) ; // If that didn't work, try finding the image relative to // the current file instead. if ( ! fs . existsSync ( loc ) ) { loc = path . resolve ( __dirname + imageUrl ) ; } } var encodedImage = getDataURI ( loc ) ; // If the encoded image meets the criteria for maximum image size, return its data URI. // Otherwise, just return the original image reference. if ( encodedImage != null ) { if ( options . maxImageSize === undefined || encodedImage . length <= options . maxImageSize ) { var url = 'url("' + encodedImage + '")' ; cache [ imageUrl ] = url ; return url ; } else { console . log ( "The image " + imageUrl + " exceeds the specified maximum data URI size of " + options . maxImageSize + ", so will not be converted." ) ; } } // If the image exceeds the maximum data URI size (or otherwise failed to encode), // fall back on the original URL reference. return fullUrl ; } }