Skip to content

Commit 0add496

Browse files
committed
Remove the options of @import rules if it is imported as regular css. #65
1 parent 3d2e5e9 commit 0add496

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/com/inet/lib/less/LessParser.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,7 @@ private void importFile( FormattableContainer currentRule, final String name ) {
542542
currentRule.add( rule );
543543
currentRule = rule;
544544
}
545+
String origFilename = filename;
545546
filename = trim( builder );
546547

547548
if( filename.contains( "@{" ) ) { // filename with variable name, we need to parse later
@@ -562,13 +563,13 @@ private void importFile( FormattableContainer currentRule, final String name ) {
562563
}
563564
if( !isLess && !isInline && (isCss || filename.endsWith( "css" )) ) {
564565
// filenames ends with "css" will not be inline else a CSS @import directive is written
565-
currentRule.add( new CssAtRule( reader, "@import " + name + ';', true ) );
566+
currentRule.add( new CssAtRule( reader, "@import " + origFilename + ';', true ) );
566567
return;
567568
}
568569
baseURL = baseURL == null ? new URL( filename ) : new URL( baseURL, filename );
569570
if( !isLess && !isInline && baseURL.getPath().endsWith( "css" ) ) {
570571
// URL path ends with "css" will not be inline else a CSS @import directive is written
571-
currentRule.add( new CssAtRule( reader, "@import " + name + ';', true ) );
572+
currentRule.add( new CssAtRule( reader, "@import " + origFilename + ';', true ) );
572573
return;
573574
}
574575
if( "file".equals( baseURL.getProtocol() ) && filename.lastIndexOf( '.' ) <= filename.lastIndexOf( '/' ) ) {

0 commit comments

Comments
 (0)