I never really intend to suggest that all CSS Hacks must be in one command. My first thought was the split of the Drag Command in different scope. It would be easier for user to customize it for their own need.
I agree that snippets are far better place for CSS Hacks. May be a separate bundle with an associated WEB site. So they would be keep update and documented with people suggest and edit.
For KISS principle, why not use those scope :
string.quoted.single.css --> $TM_DROPPED_FILE
meta.property-value.css : with test : $TM_CURRENT_WORD=='url()' # aka variable.parameter.misc.css ? --> "'$TM_DROPPED_FILE'" #really need to quote ? (otherwise as needed) #can't url(^) give the right scope ? otherwise : --> url('$TM_DROPPED_FILE')
meta.property-list.css : # really need a full background declaration ? # why not let people use background snippet if they need it. --> background: url('$TM_DROPPED_FILE') no-repeat top left; # add width and height in a tab-stop --> width: ???px; --> height: ???px; # would be the place to do IFR and like
source.css, source.css.embedded.html : # build an id selector from images name img="$TM_DROPPED_FILE" base=${img##*/} --> #$base { background: #DDD url('$TM_DROPPED_FILE') repeat/repeat-x/repe... ; /* add width and height in a tab-stop */ width: ???px; height: ???px; }
meta.attribute-with-value.id.html : # to build an id from images name img="$TM_DROPPED_FILE" base=${img##*/} with test : string.quoted.double.html --> $base otherwise --> "$base"
meta.tag.block.any.html # to build an id and title from images name img="$TM_DROPPED_FILE" base=${img##*/} title=$(tr <<<${base%.*} '_-' ' '|perl -pe 's/(\w+)/\u$1/g') --> id="$base" title="$title"
to resume : need to add a background to an HTML element : type background adjust setting and add image to value want IFR and like : type or snip code and drop image in property list (get size) Have slice for an element : drop it in HTML and CSS (get size, id, title)
Too bad that TextMate don't let you give a list of string to show as tool tip on tab stop. Or better a function hook to compute completion on each one.
Just a last idea, is it possible to filter key modifier inside drag command ?
However, don't mind mind on these suggestions, HTML (as English) isn't my main activity.
Best, pierre pracht
Brett Terpstra wrote:
I'm as big a fan of overcomplication as anybody, but I think that this might be getting away from my original intention with the command. It's really just supposed to figure out into what context you've dropped an image and give it the appropriate "decoration". It's not supposed to do all your coding for you ;-). The problem is that the techniques are being revised and improved every couple of months and you can never account for all of the IE hacks required for some techniques. The amount of inserted code gets out of hand and everybody has different preferences that you'd waste a lot of time accounting for. Best, in my opinion, to let people create their own code and just provide tools to speed up the repetitive tasks.
My suggestion would be to create snippets for the different IFR techniques and tab stop the entire background, width and height section so that you can delete it if you have intentions of dragging an image in. Then have the drag command set up so that when dropped into the property value scope it inserts background url, width and height properties. Then you could just type ifr[tab] or mezzo[tab] etc. and get the technique you want, and have the image ready to drop in. Thoughts?
Brett