@@ -42,7 +42,7 @@ var importOnce = function importOnce(data, done) {
4242 * they leave off the partial prefix and the suffix.
4343 * This code creates the possible extensions, whether it is a partial
4444 * and whether it is a directory index file having those
45- * same possible variations. If the import contains an extension,
45+ * same possible variations. If the import contains a valid extension,
4646 * then it is left alone.
4747 *
4848**/
@@ -51,6 +51,8 @@ var getFileNames = function getFileNames(abstractName) {
5151 directory ,
5252 basename ;
5353
54+ // If the name has a Sass extension, treat it as a path to a real file, and as a fallback
55+ // look for the same file with a prefix.
5456 if ( [ '.scss' , '.sass' ] . indexOf ( path . extname ( abstractName ) ) !== - 1 ) {
5557 directory = path . dirname ( abstractName ) ;
5658 basename = path . basename ( abstractName ) ;
@@ -59,9 +61,11 @@ var getFileNames = function getFileNames(abstractName) {
5961 names . push ( path . join ( directory , prefix + basename ) ) ;
6062 } ) ;
6163 }
62- else if ( path . extname ( abstractName ) ) {
64+ // If the name has a different valid extension, treat it as a path to a real file.
65+ else if ( [ '.css' , '.json' , '.yaml' ] . indexOf ( path . extname ( abstractName ) ) !== - 1 ) {
6366 names . push ( abstractName ) ;
6467 }
68+ // Otherwise, the name is abstract and all variants should be searched.
6569 else {
6670 directory = path . dirname ( abstractName ) ;
6771 basename = path . basename ( abstractName ) ;
@@ -308,7 +312,7 @@ var importer = function importer(uri, prev, done) {
308312 file = path . resolve ( path . dirname ( prev ) , makeFsPath ( uri ) ) ;
309313 raf ( uri , file , function ( err , data ) {
310314 if ( err ) {
311- console . log ( err . toString ( ) ) ;
315+ console . log ( err . toString ( ) ) ; // eslint-disable-line no-console
312316 done ( { } ) ;
313317 }
314318 else {
@@ -319,7 +323,7 @@ var importer = function importer(uri, prev, done) {
319323 else {
320324 raf ( uri , process . cwd ( ) , function ( err , data ) {
321325 if ( err ) {
322- console . log ( err . toString ( ) ) ;
326+ console . log ( err . toString ( ) ) ; // eslint-disable-line no-console
323327 done ( { } ) ;
324328 }
325329 else {
0 commit comments