Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var canViewParse = require("can-view-parser");
var someSortOfEach = /\{\{#\s*each\(/
var eachMatch = /\{\{#\s*each\(\s*([\w\.\(\)]+)\s*\)\s*\}\}/;
function processStache(source) {
canViewParse(source, {
start: function(){},
end: function(){},
close: function(){},
attrStart: function(){},
attrEnd: function(){},
attrValue: function(){},
chars: function(){},
comment: function(){},
special: function(){
console.log("--got special",arguments);
},
done: function(){}
});
}
var scriptRegExp = /<script\s([^>]+)>([\s\S]*?)<\/script>/ig;
module.exports = function(fileInfo, api, options) {
console.log(fileInfo.path)
fileInfo.source.replace(scriptRegExp, function(whole, attrs, content){
processStache(content);
})
/*
var foundSomeMatch = false;
fileInfo.source.replace(eachMatch, function(whole, variable){
foundSomeMatch = true;
console.log("updating ",fileInfo.path);
console.log(" ",variable);
return whole;
});*/
//var hasEach = eachMatch.test(fileInfo.source);
//if(hasEach) {
// console.log("discovered! ",fileInfo.path);
//}
return fileInfo.source;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.