11/*!
2- * Less - Leaner CSS v2.1.1
2+ * Less - Leaner CSS v2.1.2
33 * http://lesscss.org
44 *
55 * Copyright (c) 2009-2014, Alexis Sellier <[email protected] > @@ -794,7 +794,10 @@ module.exports = {
794794 if ( opt === "env" || opt === "dumpLineNumbers" || opt === "rootpath" || opt === "errorReporting" ) {
795795 options [ opt ] = tag . dataset [ opt ] ;
796796 } else {
797- options [ opt ] = JSON . parse ( tag . dataset [ opt ] ) ;
797+ try {
798+ options [ opt ] = JSON . parse ( tag . dataset [ opt ] ) ;
799+ }
800+ catch ( _ ) { }
798801 }
799802 }
800803 }
@@ -1214,6 +1217,7 @@ abstractFileManager.prototype.extractUrlParts = function extractUrlParts(url, ba
12141217module . exports = abstractFileManager ;
12151218
12161219} , { } ] , 15 :[ function ( require , module , exports ) {
1220+ var logger = require ( "../logger" ) ;
12171221var environment = function ( externalEnvironment , fileManagers ) {
12181222 this . fileManagers = fileManagers || [ ] ;
12191223 externalEnvironment = externalEnvironment || { } ;
@@ -1234,6 +1238,14 @@ var environment = function(externalEnvironment, fileManagers) {
12341238} ;
12351239
12361240environment . prototype . getFileManager = function ( filename , currentDirectory , options , environment , isSync ) {
1241+
1242+ if ( ! filename ) {
1243+ logger . warn ( "getFileManager called with no filename.. Please report this issue. continuing." ) ;
1244+ }
1245+ if ( currentDirectory == null ) {
1246+ logger . warn ( "getFileManager called with null directory.. Please report this issue. continuing." ) ;
1247+ }
1248+
12371249 var fileManagers = this . fileManagers ;
12381250 if ( options . pluginManager ) {
12391251 fileManagers = [ ] . concat ( fileManagers ) . concat ( options . pluginManager . getFileManagers ( ) ) ;
@@ -1257,7 +1269,7 @@ environment.prototype.clearFileManagers = function () {
12571269
12581270module . exports = environment ;
12591271
1260- } , { } ] , 16 :[ function ( require , module , exports ) {
1272+ } , { "../logger" : 31 } ] , 16 :[ function ( require , module , exports ) {
12611273var Color = require ( "../tree/color" ) ,
12621274 functionRegistry = require ( "./function-registry" ) ;
12631275
@@ -1624,20 +1636,15 @@ module.exports = function(environment) {
16241636
16251637 functionRegistry . add ( "data-uri" , function ( mimetypeNode , filePathNode ) {
16261638
1627- var mimetype = mimetypeNode . value ;
1628- var filePath = ( filePathNode && filePathNode . value ) ;
1629-
1630- var fileManager = environment . getFileManager ( filePath , this . context . currentFileInfo , this . context , environment , true ) ;
1631-
1632- if ( ! fileManager ) {
1633- return fallback ( this , filePathNode || mimetypeNode ) ;
1639+ if ( ! filePathNode ) {
1640+ filePathNode = mimetypeNode ;
1641+ mimetypeNode = null ;
16341642 }
16351643
1636- var useBase64 = false ;
1637-
1638- if ( arguments . length < 2 ) {
1639- filePath = mimetype ;
1640- }
1644+ var mimetype = mimetypeNode && mimetypeNode . value ;
1645+ var filePath = filePathNode . value ;
1646+ var currentDirectory = filePathNode . currentFileInfo . relativeUrls ?
1647+ filePathNode . currentFileInfo . currentDirectory : filePathNode . currentFileInfo . entryPath ;
16411648
16421649 var fragmentStart = filePath . indexOf ( '#' ) ;
16431650 var fragment = '' ;
@@ -1646,11 +1653,16 @@ module.exports = function(environment) {
16461653 filePath = filePath . slice ( 0 , fragmentStart ) ;
16471654 }
16481655
1649- var currentDirectory = this . currentFileInfo . relativeUrls ?
1650- this . currentFileInfo . currentDirectory : this . currentFileInfo . entryPath ;
1656+ var fileManager = environment . getFileManager ( filePath , currentDirectory , this . context , environment , true ) ;
1657+
1658+ if ( ! fileManager ) {
1659+ return fallback ( this , filePathNode ) ;
1660+ }
1661+
1662+ var useBase64 = false ;
16511663
16521664 // detect the mimetype if not given
1653- if ( arguments . length < 2 ) {
1665+ if ( ! mimetypeNode ) {
16541666
16551667 mimetype = environment . mimeLookup ( filePath ) ;
16561668
@@ -2222,7 +2234,7 @@ module.exports = function(environment, fileManagers) {
22222234 var SourceMapOutput , SourceMapBuilder , ParseTree , ImportManager , Environment ;
22232235
22242236 var less = {
2225- version : [ 2 , 1 , 1 ] ,
2237+ version : [ 2 , 1 , 2 ] ,
22262238 data : require ( './data' ) ,
22272239 tree : require ( './tree' ) ,
22282240 Environment : ( Environment = require ( "./environment/environment" ) ) ,
0 commit comments