-
Notifications
You must be signed in to change notification settings - Fork 522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pluginifyjs does not parse EJS correctly #66
Comments
As far as I remember, it is a known limitation of pluginify that it can not include views. This will be "fixed" with a future release. |
This would be nice to have! |
Is there no fix for this so far?? |
Depending on which version of steal you have you can add the following lines to package views with in pluginfied scripts. steal/build/pluginify/pluginify.js in this method add / replace if( /\.ejs/.test(steal.rootSrc ) ){
content = s.build.pluginify.getFunction(steal.text, 0)
content = '(' + content +')(jQuery)'
}else if (/steal[.\(]/.test(content)) {
content = s.build.pluginify.getFunction(content, 0)
if(content){
content = "(" + content + ")(" + param + ")";
}
} the end result might look something like this. //gets content from a steal
s.build.pluginify.content = function(steal, param, opener){
if (steal.buildType == 'fn') {
// if it's a function, go to the file it's in ... pull out the content
var index = funcCount[steal.rootSrc] || 0, contents = readFile(steal.rootSrc);
funcCount[steal.rootSrc]++;
return "(" + s.build.pluginify.getFunction(contents, index) + ")(" + param + ")";
}
else {
//s.print('rooSrc ' + steal.rootSrc)
var content = readFile(steal.rootSrc);
//########## added by Jesse Baird 1/15/2013
//test for view
//##########
if( /\.ejs/.test(steal.rootSrc ) ){
content = s.build.pluginify.getFunction(steal.text, 0)
content = '(' + content +')(jQuery)'
}else if (/steal[.\(]/.test(content)) {
content = s.build.pluginify.getFunction(content, 0)
if(content){
content = "(" + content + ")(" + param + ")";
}
}
//s.print('steal ' + content )
//make sure steal isn't in here
return content;
}
}; Hopes this helps, sometime I would like to get around to patching the newest version of steal. |
I'm going to work on fixing this now. Thanks! |
Fixed here with the latest steal: f1b7e74 |
I am using EJS templates in an app, but when I run pluginifyjs on it, the resulting JS file has the EJS code concatenated directly into it. Trying to load this file in a browser throws an error: "Illegal XML character '<%'". The pluginifyjs script should parse EJS code into regular JS before inserting into the final JS output, so that it is possible to embed EJS files in applications.
The text was updated successfully, but these errors were encountered: