This project is deprecated.
Check out STProjectMaker for a similar Sublime plugin, or use Yeoman from the command-line.
A Sublime Text 2 plug-in to allow creating any kind of project from your own custom templates.
Includes a .sublime-build
file for running npm install && bower install
for you once your project has been scaffolded.
- AngularJS
- Backbone
- Ember
- Chrome App
- RequireJS
- WebApp
Templates are stored in the /Templates
directory and can contain any arbitrary boilerplate you would like to use. We encourage the inclusion of Grunt (and a Gruntfile) for templates where possible.
There are two ways of installing sublime-init:
-
Create a folder named
SublimeYeoman
in thePackages
folder for Sublime Text 2.(If you're not sure where your Packages folder is, Go to: menu -->
Preferences/Browse Packages...
)-or-
{home}/Library/Application Support/Sublime Text 2/Packages/
is the defalt path on a MAC. -
Clone or download this project into the folder
SublimeYeoman
that you have created.The clone or download will create a folder named
sublime-init
. -
Once the colne or download has completed proccede to the new folder
sublime-init
.(
{home}/Library/Application Support/Sublime Text 2/Packages/SublimeYeoman/sublime-init
) -
Select all the contents in the
sublime-init
folder and move them to the folder that you had created namedSublimeYeoman
. -
see P.S.
-
Clone or download
sublime-init
into yourPackages
folder. (see Method 1 if needing help locating this folder) -
Once clone or download is complete change the folder named
sublime-init
toSublimeYeoman
. -
see P.S.
On MAC:
1.Open Terminal or your application of choice.
2.$cd
into the Packages
folder of Sublime Text 2.
The Default path for Sublime Text 2 is {home}/Library/Application Support/Sublime Text 2/Packages/
-
run this command:
$git https://github.com/yeoman/sublime-init.git
-
Follow steps from Method 1 -Step 3 or Method 2 -Step 2.
I like to override Control-Shift-N
Go to: menu --> Preferences/Key Bindings - User
[
{ "keys": ["ctrl+shift+n"], "command": "project_maker" }
]
Invoke "SublimeYeoman" from the command palette to show a Quick Panel list of available templates.
Top Menu --> Tools
--> Command Palette
and start typing SublimeYeoman
. If you used the optional Key Binding
it will populate next to the Package name.
Choose the template to base your project on:
You will be prompted to enter a path for your new project. You may be prompted for values for any replaceable tokens in any template files or file names. Enter the values you want to use.
Newly created project folder will be opened up in Sublime Text:
A template is simply a folder stored in <sublime packages dir>/SublimeYeoman/Templates/
. It can contain any number and types of files and nested folders of files.
Sublime populates its Tools/Build System menu based on the “.sublime-build” files stored in the Sublime “Packages” directory.
Should one need to locate this, it can be found in “~/Library/Application Support/Sublime Text 2/Packages/User” (if using OS X) or the corresponding Packages/User directory on other platforms. Copy and paste the yeoman.sublime-build
file into Packages directory.
Builds can be executed using a keyboard shortcut (Command+B on Mac is the default on Mac or F7 on Windows), via the Tools menu or when a file is saved. If a project is currently open, the build system we last selected (e.g grunt) will be remembered.
Text files in the template may contain replaceable tokens in the form of ${{token_name}}
. When you create a new project, you will be prompted for values to use for each token found. The same token can be used multiple times in multiple files. You will only be prompted a single time for its value.
Example:
Hello from ${{user_name}}
when supplied a value of Paul
for the user_name
token will become:
Hello from Paul
Template file names may also be tokenized using the form _token_name_.ext
. The leading underscore, token name and trailing underscore will be replaced by the value given.
Example:
/foo/bar/baz/_info_file_.text
when supplied with a value of data
for the info_file
token will become:
/foo/bar/baz/data.text
There are two predefined tokens:
${{project_path}}
in text files will be replaced by the absolute path of the new project directory.
${{project_name}}
in text files or _project_name_
as a file name will be replaced by the base name of the project directory.
Example:
Project path is /foo/bar/baz/MyProject/
project_path
will be replaced by /foo/bar/baz/MyProject/
project_name
will be replaced by MyProject
If the chosen template has a .sublime-project
file in the top level, that file will be copied over and processed like any other file in the template. However, if this does not exist, a default .sublime-project
file will be created using the project_name
token as its base name.
Sublime Yeoman currently ships with samples static templates for a number of different types of projects. These templates are the output of the corresponding Yeoman generators, however we eventually intend on shelling out to the yo
binary to provide access to all Yeoman community generators.
We are currently evaluating the usefulness of this project through an alpha ST2 version being made available. If there is enough interest in an ST3 implementation, we will attempt to work on and support that too.
You don't want to try to do token replacement in binary files. The plug-in has a long list of file types that it will ignore when doing token replacement. You can always add your own if any files in your templates cause a problem. The list is contained in the yeoman.sublime-settings
file. Note, these files will be copied into the project. They will just not be parsed for tokens.
BSD license Copyright (c) Google