berfarah / LESS-build-sublime

Less build sytem for Sublime Text 2
Apache License 2.0
91 stars 14 forks source link

Build not working in the portable Windows version of sublime #10

Open catearcher opened 12 years ago

catearcher commented 12 years ago

As the packages are located in a different directory in the portable version of Sublime, the current build script does not work here. You can fix this by using the $packages variable directly in the "cmd" property and dropping "path", like so:

"windows":
{
  "cmd": ["$packages/LESS-build/dotless.Compiler.exe", "$file"]
}

(same for the MIN.LESS file)

I guess this will work for both the portable and the installed version, although I haven't tried it in the latter.

claudio5678 commented 12 years ago

tks indieboy, I`m also on the portable version (windows) and the compiler was generating the message [Decode error - output not utf-8]

in fact it has nothing to do with encoding, it was a path problem, wich is fixed by your config.. no idea why ${packages} won`t work with the path property but your way does the trick

jess-sol commented 12 years ago

Hi, just a heads up the newest version should work with portable sublime on windows. Could you confirm and report an issue if it does not?

Thanks

claudio5678 commented 12 years ago

Hi there mazzz...

I noticed you pushed a new version today, at least the build has changed. Unfortunately it still doesn't work on my win7 / portable sublime environment.

When trying to build a .less i get:

[Decode error - output not utf-8] [cmd: [u'dotless.Compiler.exe', u'C:\ccd\jobs\piramidal\generico\assets\css\style.less', u'style.css']] [dir: C:\ccd\jobs\piramidal\generico\assets\css] [path: C:\Users\Claudio\AppData\Roaming\Sublime Text 2\Packages\LESS-build] [Finished]

Actually the reported path is not valid, it should be C:\ccd\sublime\Data\Packages\LESS-build on my system.

By the way, to get it working I changed the build from "cmd": ["dotless.Compiler.exe", "$file", "${file_base_name}.css"],

to... "cmd": ["$packages/LESS-build/dotless.Compiler.exe", "-c", "-r", "$file", "${file_base_name}.css"],

Tks

jess-sol commented 12 years ago

Hi @claudio5678,

That is the change I had made in the newest version, could you check to see if you are using the absolute newest version (as I there have been many updates recently)? Specifically check that LESS-normal.sublime-build-choice are the same (as that looks like the file you're using).

Thanks

claudio5678 commented 12 years ago

Sorry but I'm fairly new to git and sublime text so I don't feel comfortable pushing code. Anyway, I didn't have the last version. I synced it now and there where a few issues. To sum it up the variant LESS-rewriteDir.sublime-build-choice does the trick. What makes it work is passing $packages\LESS-build\ to the cmd parameter. Tks

jess-sol commented 12 years ago

Don't worry about it, though I will say that making a pull request is quiet simple, I'm fairly new to it and it was pretty simplistic (plus because somebody on the project is required to validate the push, you can't really do anything bad).

I don't have a portable version, but both build systems (normal and RewriteDir) and both of their variants should work with portable now. I can download a portable version and test it but that is a ton of work, so if you can tell me which os and build system/variants aren't working that would save me a lot of time and I can update it more quickly :)

jess-sol commented 12 years ago

Also I just pushed a new version (I found what I think is the bug causing your issue), so could you re-pull the newest version and test on it? Thanks :)

claudio5678 commented 12 years ago

I got your most recent version but there are still 2 issues:

1) As far as I know symbolic links don't work in Windows so I had to copy the content from one of the build choices to the main LESS.sublime-build to be able to test them

2) The normal variant has a trailing comma on the windows "cmd" line and sublime keeps complaining about it. After striping the coma it works just fine

So I guess the main issue would be #1... I suppose you'll have to avoid symlinks in order to make this package work on windows...

jess-sol commented 12 years ago

Odd, the symlink works fine in Windows 7 for me (I retested everything with the newest version on Win7 and Ubuntu 12.04). The trailing comma would have caused the sublime-build to not be found (my fault, thanks for fixing); maybe that is what caused sublime not to find it, not the symlink? What version of windows are you running on? Try keeping the symlink and fixing the trailing comma in the LESS-normal file. (To recreate the symlink just run the .bat script)

claudio5678 commented 12 years ago

I'm on Win7 with NTFS filesystem. The thing is I got the last version from a zip file and manually replaced the Packages/LESS-build directory contents. This way the symlink won't work. So I tried reinstalling the package from sublime package manager... and it still doesn't work as a symlink. The only way I managed to make it work was running the .bat script. The mklink command does the trick and I suppose that's why it works on your windows. But I suppose when syncing from git or from a ZIP file the symbolic link won't work.

jess-sol commented 12 years ago

Alright, everything should be happy now. I had a special testing environment that caused the symlinks to work, where they wouldn't anywhere else. This is because git stores symlinks as blobs with the symlink destination (and when you checkout with git it renders this blob back into a symlink, but this doesn't occur when you get the zip or pull from the package manager). So as of now it should work fine. The only issue will be that if the LESS-normal is updated in the future, it'll reset everyone's choice back to normal :/; not sure how to get around that.

claudio5678 commented 12 years ago

Yes, that makes sense, nice fix. About choosing the build config.... I decided to take a different approach here. Instead of using the *-choice files I have a LESS-normal.sublime-build and a LESS-redirect.sublime-build. This way I can switch between them directly on the build system menu. Also I changed the "name" prop on the variant config to "LESS Minify Normal" and "LESS Minify Redirect" to represent them more accurately. I don't know if thats better just for me but it sure makes sense here.

jess-sol commented 12 years ago

The issue is that most people (including myself), enjoy the automatic build system; which to my understanding wouldn't be possible with two build files of the same type. So with your solution it wouldn't be possible to use the auto build system.

claudio5678 commented 12 years ago

Oh, that's right. I'm currently not using ant or any other build system in my sublime projects so for me it's more practical that way. But FWIW, even with "automatic build" marked as the build system plus the the 2 .sublime-build configs, ST2 still manages to build .less files normaly with ctrl+b. It actually uses the LESS build-system I had chosen before "automatic build". It may be a little confusing but for me it's ok.

jess-sol commented 12 years ago

Hm, I'll need to experiment with this a bit more tomorrow, there very well may be a better way. Maybe I can bug a plugin dev to write a quick little script to read a config file this setting can be stored in and make the symlink, that'd work really well for everyone then.