in our require.js and backbone.js app we use many views and templates.
in a buildstep we want to inline the templates with the appropriate view shims and remove the text plugin from the build in the process.
is that even possible?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
That is automatically taken care of by RrequireJs when you run their r.js utility.
There’s no additional effort involved to ‘inline’ the templates.
As long as your templates are defined like so:
Running r.js -o app.build.js will inline all your
text!templates/my.htmlinto its own string in your optimized javascript file. Here’s a sample of my app.build.jsRequireJS is smart enough to inline your dependencies prefixed with
text!. In other words, the text plugin is only used in your development version. The optimized version will not require the text plugin.If you’re interested in more details, you’ll find the instructions to optimize your project on RequireJS’s site. You can also find a detailed sample of the build file with all possible options documented here