By using Shell-Turtlestein and snippet, you can use bash script on Sublime Text 2 to assist us creating a project.
Here you can find how to do it with Alfred. Please have a look at the video. But I will show you here how to do it within Sublime Text 2. I tested it with Mac. But it should work in Windows with little code changes.
First you create a Template directory and add necessary folder and files except backbone, jquery etc.
~/Template/backbone/ index.html assets/ css/ js/ libs/ models/ views/
Now you need to install Shell-Turtlestein through Package Control. Shift+Command+p to open Package Control and type ‘install’. Then type Turtlestein to find Shell-Turtlestein to install.
You need to create a snippet in Sublime Text 2. Goto Tools>New Snippet and enter the following and save as backbone.sublime-snippet(create a folder shell under ~/Library/Application Support/Sublime Text 2/Packages/User/shell/backbone.sublime-snippet).
<snippet> <content><![CDATA[ cp -R ~/Templates/Backbone/ . ; curl http://backbonejs.org/backbone-min.js > assets/js/libs/backbone.js ; curl http://underscorejs.org/underscore-min.js > assets/js/libs/underscore.js ; curl http://code.jquery.com/jquery.js > assets/js/libs/jquery.js ; /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl . ]]></content> <!-- Optional: Set a tabTrigger to define how to trigger the snippet --> <tabTrigger>bb</tabTrigger> <!-- Optional: Set a scope to limit where the snippet will trigger --> <scope>source.shell</scope> </snippet>
Now all are ready to execute it. Create a folder and a file called index.php in Sublime. Then Shift+Command+c to open a Shell-Turtlestein console. Type bb +tab to display commands, then enter to run it.
You should have backbone-min.js, underscore-min.js and jquery.js under js folder and all other folders and files you created under ~/Template folder.