Sublime Forum

Build System preserving folder structure

#1

Hey!

I’m trying to create a sublime-build code in order to work on this folder structure

root
|-- app
|   |--css
|   |--js
|
|-- app-raw
|  |--less
|  |      |-- style.less
|  |
|  |--coffeescript
|          |-- app.coffee

I’m trying to complie a less file and put it into the css folder wiht the same name. I’ve tried this:

"lessc > $project_path/app/css/$file_base_name.css --yui -compress"

And it work great, but If I want to add subfolders like this

root
|-- app
|   |--css
|   |--js
|
|-- app-raw
|  |--less
|  |     |-- style2.less
|  |     |--somefolderName
|  |           |-- style2.less
|  |
|  |--coffeescript
|          |-- app.coffee

Then I don’t know how to make the system, dynamically understand which folder it has to put the compiled file.
Is there anyway to know, on the sublime-build file, which is the folder above (or ideally some folder until a certain one)

Also, is there any way for the selector to work only on certain files based on the name?

Thanks in advance!

0 Likes

#2

I’ve found a solution to my problem. I’m using this regex with my project.

{
	"cmd": "cmd", "/c", "coffee --watch --compile --bare --output ./${file_path/-raw//}", "$file"],
	"selector": "source.coffee"
}

It simply looks for the file path, if it contains “-raw” it gets delited. Works great :smile:

0 Likes