Closed paulwe closed 11 years ago
Can you give me a little more context on the error you were having and how I can reproduce it?
Make a template with a variable in it...
span= foo
Add the directive suggested in the readme to the build config.
pragmasOnSave: {
excludeJade: true
}
Build the app and try to execute the template function... it throws a type error while trying to execute undefined, the escape function in this case.
After reading the jade docs it seems it may not be necessary to include the jade library, the correct solution is to substitute jade's runtime.js for jade.js. It looks like this can be implemented by adding a writeFile method. The docs might suggest adding "optimizeAllPluginResources: true" to build configs...
Please look around line 3710
in jade.js
. When you build your app with r.js
and have the excludeJade: true
flag in pragmasOnSave
it should first compile your templates using the regular jade compiler and then include the jade runtime when saving the minified code to the output file.
Please see this discussion.
r.js example.build.js see the section on pragmas
and pragmasOnSave
starting at line 148
.
Please let me know if this helps you out.
Thanks... As I mentioned before, the build directive was set correctly. The code you referenced appears in the the output file as expected. Unfortunately this is given as the definition for jade:
define('jade',{
version: '0.0.1',
load: function (name, parentRequire, load, config) {
}
});
I can vouch for this issue and pull request.
Require-jade was working fine until being built with r.js, after that I was getting the error undefined is not a function
coming from attrs
. I had the config set with: pragmasOnSave: { excludeJade: true }
. After switching to the fork by @paulwe it worked correctly.
@hapticdata thanks for the feedback.
Templates built with r.js crash because the jade object returned in define isn't a reference to the jade runtime...