Organiccat
Organiccat

Reputation: 5651

Using twitter recess, getting "error reading file" when trying anything except a file name

I'm trying to compile some less files, but I get "Error reading file" unless I specify one file at a time while in that directory. I have a directory called /less and .less files inside of it. Please assume I did the commands from the correct directory:

recess /less --compile

recess *.less --compile

recess /less/*.less --compile

recess ./less/*.less --compile

The only one that works is:

recess main.less --compile

And I have well over 20 files to compile, so that's not ideal. I'm on a windows machine using regular old command prompt if that makes any difference.

Upvotes: 0

Views: 298

Answers (1)

rrotaru
rrotaru

Reputation: 1

The problem here is Windows' wildcard expansion is not the same as on Unix machines. The following link describes the difference between the two.

Basically, on Unix the command recess *.less gets expanded by the shell into recess file1.less file2.less file3.less etc., then that list gets passed as args to RECESS. In Windows' command prompt, the literal string "*.less" gets passed as an arg and RECESS is expected to handle expanding the wildcard.

Other than by submitting a feature request to the devs of RECESS, there's no way to directly use wildcards when calling RECESS from the command prompt.

There is a workaround though.

You can use @import in LESS to specify files that need to be imported from the same directory before compiling. So you can create a single file with an @import for all of the other files in your folder, and call recess --compile with that file as the path argument.

For an example, look at Twitter's bootstrap.less file. Using that, you could just call:

recess --compile bootstrap.less > ./bootstrap.css

And all of those files would be compiled into a single CSS file named bootstrap.css.

Upvotes: 0

Related Questions