bdkjones / CodeKit-1-Old

146 stars 1 forks source link

bug: less import chain not picking up #397

Open graymouser opened 12 years ago

graymouser commented 12 years ago

Heya, I had a look through open bugs and couldn't find this one, though it may be similar to this closed bug https://github.com/bdkjones/CodeKit/issues/7

Basically I am modifying bootstrap.less to import a custom less file, when it is written like the following then CodeKit does not automatically pick up that ts-variables.less is imported by bootstrap.less

// Core variables and mixins
@import "variables.less"; // Modify this for custom colors, font-sizes, etc
@import "ts-variables.less"; //Custom variables for site
@import "mixins.less";

However if refactored the following way then it does

// Core variables and mixins
@import "variables.less"; // Modify this for custom colors, font-sizes, etc

//Custom variables for site
@import "ts-variables.less"; 

@import "mixins.less";

Although it is not really a problem for me now that I now about the refactor it was quite annoying to track down so thought I'd report it. Other than that just started using CodeKit and having much fun, keep up the great work :)

mcmillion commented 12 years ago

After testing this out some more, this is the issue causing my Less to no longer compile correctly (the compiled Less was empty). The workaround that seems to be working for me is to put a comment before each import, just as @graymouser showed.

bdkjones commented 12 years ago

Ah, cool. Yes; at the moment adding a comment to the same line as the import statement will cause issues.

mcmillion commented 12 years ago

Just having multiple import with no comments causes issues as well. This appears to happen with or without extra line breaks between the imports.

mcmillion commented 12 years ago

Any chance this is going to get looked at anytime soon? Going back and filling all my Less files with extra comments is getting rather annoying.

bdkjones commented 12 years ago

It's on my list, but it's fairly low priority. Just make sure your comment isn't on the same line as the import statement and you'll be just fine.

mcmillion commented 12 years ago

Maybe this needs to be broken out into a separate issue, but the problem also occurs with imports that do not have comments. For example:

@import 'reset.less';
@import 'variables.less';
@import 'mixins.less';
@import 'layout.less';
@import 'type.less';
@import 'sprites.less';

This compiles without error, but the resulting CSS is missing half of the content of the imports. Adding a comment like this fixes it:

@import 'reset.less';

// Workaround
@import 'variables.less';

// Workaround
@import 'mixins.less';

// Workaround
@import 'layout.less';

// Workaround
@import 'type.less';

// Workaround
@import 'sprites.less';

I can confirm that this doesn't happen in the latest version of Less and Less.app.

bdkjones commented 12 years ago

Nope. I have plenty of tests that prove the import linking works just fine for the scenario you described. There are a few possibilities:

1) One of your imported Less files is blank. The Less compiler currently chokes on those.

2) Your file is not UTF-8 encoded. Any other text encoding is not supported.

3) Your file does not use normal line endings. This one is unlikely, but possible.

mcmillion commented 12 years ago

If any of those were the case, why does it suddenly work fine when comments are introduced before each line?

bdkjones commented 12 years ago

Please zip and send me a chain of Less files that demos this issue so I can test things on my end. Thanks!