I need to, in the process of editing the html-code in the html / php file, you can write the haml-code and when you press a certain key, the haml is converted to html. Emmet works in a similar way.

  • Refine the editor or development environment. - edem
  • Sublime Text 3, but if this possibility is for other editors, it would also be interesting to know - Nikolay Gnatovsky

1 answer 1

You can not require this from the editor

You can use HAML directly and write markup on it, generating HTML automatically. Support for editors is not needed for this; you need only fresh enough Ruby (2.2+) with the bundler gem install bundler ( gem install bundler it if you have RubyGems) on the machine.

With Ruby, this can be done fairly easily using guard-haml .

  • Make a Gemfile in the project folder:

     source 'https://rubygems.org' gem 'guard-haml' 
  • Make bundle install so that it installs and generates Gemfile.lock

  • Making guard init so that the Guardfile will be Guardfile , in which the rules for tracking files and their regeneration will be defined, initially it will detect guard-haml and make a rule for it (reference comment above is omitted):

     guard :haml do watch(/^.+(\.html\.haml)$/) # Это регулярка для путей к исходным файлам end 

    You can add the folder "source files" and "result" to the rule so that they are not in the same heap:

     guard :haml, input: 'src', output: 'public' do watch(/^.+(\.html\.haml)$/) end 
  • Create somewhere in the source folder (or current) any file of the form *.html.haml , save, and voila, in the folder with the result (or current) appears the corresponding *.html .

  • If you need to exit Guard, you can press Ctrl + D or execute exit in its console.