简体   繁体   中英

How to create snippets for rails view in atom text editor

I want to add these rails views snippets in atom text editor. But I don't know how to do it. Can anyone provide some suggestion. I have used html.erb

<%= %>

<% %>

This is what I have but I can't figure out the source type

'.source.html.erb':
 'embed =':
'prefix':'='
'body':"""
  <%= $1 %>
"""

'.source.html.erb':
 'embed':
'prefix':'-'
'body':"""
  <% $1 %>
"""

Thank you in advance.

I have this snippet on my snippets.cson in Atom and work fine, You can try it.

'.html':
  'Ruby line':
    'prefix': '%'
    'body': '<%= $1 %>'

Click on Atom in the main menu, then click on snippets. This is the file where you can create custom snippets. For your snippet, you can enter this code:

'erb':
    'prefix': 'erb'
    'body': '<%= ${1:object} %>'

For more information on creating custom snippets, checkout Atom.io Snippets

Try this:

'.text.html.erb':
  'Hello':
    'prefix': 'hi'
    'body': '<%= "Hello" %>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM