web-mode
web-mode copied to clipboard
Feature request: engine variable comment that overrides web-mode-engines-alist
Right now web-mode-enable-engine-detection works only if no other engine detected.
E.g. I have a bunch of ".html" files. Most of them are acutally Django templates, but some of them are pure HTML, some are underscore templates.
I would like it to be Django templates by default, but switch to underscore when I specify manually:
{# -*- engine:underscore -*- #}
<script id="tree-node-template" type="text/html">
<span class="name
<% if (dynex_count > 0) { %>
has-exercises
<% if (!ADAPTIVITY_ENABLED) { %>
not-selectable
<% } %>
<% } %>
" data-path="<%= path %>"><%- name %></span>
<% if (dynex_list.length) { %>
<ul class="dynex-list">
<% _.each(dynex_list, function(d){ %>
…
…
My quick dirty fix is simply allowing local variable to override the engine. But it probably breaks behavior for some other cases, I'm not sure if it's appropriate.
web-mode-engine (web-mode-engine-canonical-name web-mode-engine))
)
- (when (and (or (null web-mode-engine)
- (string= web-mode-engine "none"))
- web-mode-enable-engine-detection)
+ (when web-mode-enable-engine-detection
(web-mode-detect-engine))
(web-mode-on-engine-setted)
@highcat why don't you rely on the path off the templates (or of the projet) to force the engine ?