liamcain / AutoFileName

Sublime Text plugin that autocompletes filenames
514 stars 78 forks source link

Add image dimension support for template languages like Slim #54

Closed manafire closed 10 years ago

manafire commented 10 years ago

This patch allows support for templating languages like Slim and Jade which don't have the angle brackets on img tags.

When using AutoFileName, this patch will allow turn templates structured like this:

      table
        tr
          td width='50px'
            img src="images/my-image.jpg"

into this:

      table
        tr
          td width='50px'
            img src="images/my-image.jpg" width="50" height="50"

Regular HTML <img ../> tags will still work, as some templates support them.

To enable, the template scope must be added to afn_valid_scopes and afn_template_languages must be set to true, like so:

...
"afn_valid_scopes":["string","css","sass","less","scss","slim"],
"afn_template_languages": true,
....
liamcain commented 10 years ago

I'll test this out tonight but it looks good. Just want to confirm it all works before I merge.