I have a particular problem using {{mustache}} with Sublime Text. I know there are (one or more) plugins for HTML Mustache. But I have a problem in that I might use {{mustache}} in ANY of my source files. And, so, it breaks many of the syntax formatters and checkers.
I use it for generating software configurations. That is, I create multiple differentiated apps from the same codebase, using a combination of overlay directories (i.e. substitute files from a product-specific directory, if present) as well as both text substitution and conditional inclusion using {{mustache}} tags. (Data comes from YML configuration files.)
Prior to build, there is a configuration step, where the entire project is copied to a build directory, with source files being passed through Mustache.
So - simple case - I might have, e.g.
HTML
<title>{{build.product_title}}</title>
Javascript
var title = '{{build.product_title}}';
ERB
<section class='info'>
<%= uiBanner '{{build.product_title}}' %>
</section>
This is troublesome, though, regarding syntax highlighters, bracket highlighters, syntax checkers, etc. etc. etc.
xx-mustache (e.g. html-mustache, ruby-mustache, javascript-mustache) is obviously not a viable solution!
I realized recently that I can work-around - for conditionals - in languages that have single-line comments.
//{{#ui.shake_errors}}
// some code here that will do something if ui.shake_errors is true
//{/ui.shake_errors}}
There are still some issues with this, because while the {{}} tags are then not seen as syntax errors, sometimes the code included inside the conditionals will create a syntax error, though those are fairly uncommon.
Is there some way to use a regex to have patterns removed prior to passing to a syntax highligher or linter or bracket highlighter, etc? (But of course, then, how do they get back IN… say in the case of a syntax highligher?)
Or is what I am doing just too strange? The thing is, it’s way useful as I regularly need to publish multiple applications from a common codebase while avoiding version drift. (All are published simultaneously.)