jnordberg / wintersmith

A flexible static site generator
http://wintersmith.io/
MIT License
3.5k stars 335 forks source link

Building LESS file fails with file wasn't found error #269

Closed emirotin closed 9 years ago

emirotin commented 10 years ago

I have a Wintersmith project using LESS.

My main.less imports lots of small module files (and a couple of libraries installed through bower) and everything works just fine in preview mode.

But it fails when I try to build the project.

My @imports are relative and I have

"less": {
    "relativeUrls": true
  }

in config.json. It seems that relative imports are the source of the problem — if I reduce my main.less to a single line and change it from import "settings/settings"; to import "contents/settings/settings"; it works (well, fails on a different file, but at least goes over this line).

What really surprises me is that it still works in preview mode.

Is it something relatively easy to fix without replacing all imports in all my modules? Thanks in advance!

emirotin commented 10 years ago

It also tries to separately build all individual less files. So for example in main.less I have

@import "section";
@import "footer";

and the footer.less uses inheritance from a class defined in section.less.

This works just fine when the main.less is compiled, but fails when it tries to compile footer.less alone.

emirotin commented 10 years ago

Sample repo https://github.com/emirotin/ws-error

roblafeve commented 10 years ago

+:one: @emirotin I'm experiencing the same thing using Stylus @extend

jnordberg commented 9 years ago

It works in preview mode because the files are built on demand and you never request the footer directly. But in build mode all files are walked over and built. To fix it just add the offending files to your ignore list in config.json,

Sorry for the slow response..

emirotin commented 9 years ago

Sorry it just doesn't make sense to me. There are no offending files. Check the sample repo linked above if you're interested

jnordberg commented 9 years ago

Check this https://github.com/emirotin/ws-error/pull/1

emirotin commented 9 years ago

OK makes sense now. So when you say offensive you mean the files that are dependent and don't have to be compiled on their own. Thanks.

jnordberg commented 9 years ago

Yep, that's it. Also the LESS plugin is configured to ignore any file starting with underscore _ so you can just name your files like that and they will not be compiled individually