Set HTML syntax on file.html.js


How can I tell Atom to treat all file-name.html.js files as HTML?


If you don’t want to edit the language-html rules then you can add <!doctype html as the first line of the file and then it will always open using the HTML grammar. Otherwise you have to edit the atom/resources/app/node_modules/language-html/grammars/html.cson file to include html.js in the fileTypes list.


Editing files in atom/resources is virtually always the wrong thing to do. These files will be overwritten on the next update to the package.

Putting the following in your should work:

atom.workspace.observeTextEditors (editor) ->
  if editor.getPath()?.match(/\.html\.js$/)

Language Selection - Autodetect doesn't work
Set default syntax for erb files

I think the file-types package would work too