¿Convertir .haml a .html en Notepad++?

¿Convertir .haml a .html en Notepad++?

¿Cómo configuro Notepad++ para ejecutar automáticamente la línea de consola "haml [nombre de archivo.haml] [nombre de archivo.html]" cada vez que actualizo y guardo un archivo .haml?

Respuesta1

Puede hacer esto con el complemento Python Script; simplemente agregue un nuevo 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])

Puede agregar esto a startup.py para que se ejecute automáticamente al inicio (cambie también la configuración de Python Script a "ATSTARTUP").

Respuesta2

¿Qué tal si usamos algo como unvigilante¿guion?

Algo como:

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

Debería recompilar automáticamente su archivo html cada vez que cambie el haml fuente.

información relacionada