Created
September 25, 2018 15:16
-
-
Save justinbmeyer/6eb86e2836d3b4ec7f0dbe832ce9e4fd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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