Sublime Forum

Any way to build without saving file first

#1

Hi

I’ve got my Coffeescript builder going, which looks like this:

{
	"cmd": "coffee", "$file"],
	"selector": "source.coffee"
}

However, is there any way for me to type coffeescript code in an an unsaved file, and run the builder on it?

(I switch the syntax of the unsaved file to coffeescript, so Sublime knows that it is a coffeescript file).

Currently, when I run the builder on an unsaved document I get this error:

            throw new Error("File not found: " + source);
                  ^
Error: File not found: 
    at /Users/indy/Development/Node/lib/node_modules/coffee-script/lib/command.js:66:19
    at path.js:395:19
[Finished]

I can see why this would happen as the file doesn’t exist. But I’m unable to find the correct variable to add in the coffeescript builder. I’ve seen the variables listed at: sublimetext.com/docs/build, but none seems to fit the bill.

Essentially what needs to happen is that if the file is unsaved, and a builder is run on it, it needs to be run from a temporary folder (like TextMate does).

Is this possible at all?

Thanks

Indy

2 Likes

#2

That’s something I would like as well, to be able to build and validate without having to save the latest changes to the original file first. If you’ve been working on a file and you run the build, the output won’t refresh unless you save the file again.

0 Likes