I use web-mode in Emacs, everything is fine except that when editing a .js.erb
file in Rails.
Because there's only 2 modes in .js.erb
file: js
and ruby
and web-mode only recognize javascipt code in <scipt type="javascript"></scipt>
.
I'm not very familiar with emacs and web-mode, maybe there's a way to config.
You can change the "default" mode of an active buffer by modifying the variable web-mode-content-type
, eg from M-:
:
(setq web-mode-content-type "javascript")
Default modes may be specified by file name (or pattern) by modifying the web-mode-content-types
alist somewhere in your configuration, eg
(eval-after-load "web-mode"
'(add-to-list 'web-mode-content-types '("javascript" . "\\.js\\.erb\\'")))
web-mode
的作者已解决此问题,因此只需更新您的网络模式
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.