Automate Adding Closing Comments With Atom

When writing HTML I like to have closing comments after elements. You can do this with a special file.

On Macs, the file will be located in the home directory.

$ cd

Takes you to your home directory.

Then create an emmet folder in your home directory.

Inside your emmet directory create the syntaxProfiles.json file.

Add this inside it

{
  "html": {
    "tag_case": "lower",
    "attr_quotes": "double",
    "self_closing_tag": true,
    "filters": "html, c"
  },
  "jsx": {
    "tag_case": "lower",
    "attr_quotes": "double",
    "self_closing_tag": true
  }
}

In your HTML you see ‘filters’ the c is what adds the closing comment

Some people like to use single quotes instead of double quotes. Just update your attr_quotes value and you will be off to the races.

The JSX is in case you are working with HTML inside your JSX files.

Leave a Reply

Your email address will not be published. Required fields are marked *