Converter .haml em .html no Notepad ++?

Converter .haml em .html no Notepad ++?

Como configuro o Notepad ++ para executar automaticamente a linha do console "haml [nome do arquivo.haml] [nome do arquivo.html]" sempre que atualizo e salvo um arquivo .haml?

Responder1

Você pode fazer isso com o plugin Python Script - basta adicionar um novo script como

notepad.clearCallbacks([NOTIFICATION.FILESAVED])

# Define the function to call just after the file is saved
def runHaml(args):
    filename = notepad.getBufferFilename(args["bufferID"])
    if filename[-5:] == '.haml':
        cmd = r'cmd /c C:\path\to\haml "{0}" "{1}.html"'.format(filename, filename[:-5])
        console.write(cmd + "\n")
        console.run(cmd)


# ... and register the callback 
notepad.callback(runHaml, [NOTIFICATION.FILESAVED])

Você pode adicionar isso ao startup.py para que ele seja executado automaticamente na inicialização (altere a configuração do Python Script para "ATSTARTUP" também).

Responder2

Que tal usar algo como umvigiaroteiro?

Algo como:

watch( '(.*)\.haml' ) do |md|
  system("haml #{md[0]} #{md[1]}.html")
end

Deve recompilar automaticamente seu arquivo html sempre que o haml de origem for alterado.

informação relacionada