Sublime Forum

Suggestions for developing a SublimeText2 plugin

#1

I was fascinated by what one can do within ST. The ways to extend it are simply incredible, and open the doors to massive productivity.

Unfortunately, I am still not familiar with all the specifics of the API, to tell which the simplest way to do the following thing would be (if it is possible)

In client side web development, what I’ve always hated was all the boilerplate that I had to write over and over again in three different files (app.html, style.css, main.js, for example). Take the following example: to be able to create tabbed content using jQuery, I have to not only call $("#element").tabs(), but also to add the necessary css in the style file, add the necessary layout in the html file (ul,li with specific ids), and add the necessary dependencies to the html file (jquery, jquery-tabs, the style files, if they’ve not been added yet)

It would be so much simpler If I could, using a global configuration file (for example the file that ST generates for every newly created project), declare a series of conventions which would then be used by the extensions, to decide where to insert a given snippet. Imagine the following

//Usually most web apps have one main css file, as well as one layout file (index.html or app.html) INDEX=“app.html” MAIN_STYLE:“style.css”

then, when I need tabs in my app, in the JS file, I will simply go for:

tabs [hit TAB] … $("#element").tabs(); [hit TAB] … $("#mydiv").tabs();

which will automatically prepare the necessary dependency injections, and will create the necessary boilerplate CSS and html code for me

I think now that I explained it, this doesn’t seem so easy to do right. It might be easier to interpret the whole app as a DOM tree, and then adding the necessary stuff through DOM, instead of manipulating the raw files with regex and string substitutions … I am also thinking about using node.js to generate the DOM …

Suggestions? Ideas?

0 Likes

#2

It sounds like you want auto-generated snippets/wireframes. You can probably use the jQuery snippets library through Package Control for quicker development - and create your own snippets over time. Or set up a personal code repo for modularised wireframes which you can just copy/paste into a project folder.

While this sounds like it would be an incredible plugin, you may need an IDE to do exactly what you’re describing.

0 Likes