CURL - why are the Script tags in the main index.html sometimes not shown?

25 views
Skip to first unread message

Ged Wed

unread,
Jun 23, 2013, 9:38:34 AM6/23/13
to cuj...@googlegroups.com
For the tutorial cujojs applications i can see the script element referencing all the dependencies in the index.html.

For other external project that use require i have noticed that i cant.

I would like to be able to hide the SCRIPT elements from showing up in the index.html.
Does anyone know how to do this ?

Charilaos Skiadas

unread,
Jun 23, 2013, 2:48:25 PM6/23/13
to cuj...@googlegroups.com
The seed is probably what I would use as a model:

https://github.com/cujojs/seed#readme

If that's not working for you, maybe you can explain further what you mean, perhaps with a small example or at least links to what you refer to?
There are many tutorial applications.
You can't have no script elements at all in your index.html. but typically you should need just 2, one to load curl, and one to use curl to load your app/run.js file.

Unless you mean something different by "hide the script elements".

Haris Skiadas

Brian Cavalier

unread,
Jun 23, 2013, 3:12:50 PM6/23/13
to cuj...@googlegroups.com
Hey Ged,

During development, AMD loaders load each module individually, hence you typically end up with 1 script element per module.  In addition, when using versions of curl prior to 0.7.4 (very recently released), you needed 2 script elements in index.html to bootstrap an app: 1 for curl.js itself, and one for a script that calls curl to kick things off, typically named "run.js".  curl 0.7.4 allows you to point at "run.js" via a data-curl-run attribute on the curl.js script element, so reduces the number of script elements by 1.

I recently updated cujoJS's TodoMVC implementation to use curl 0.7.4, and now it only has a single cujo-specific curl.js script element (https://github.com/tastejs/todomvc/blob/gh-pages/labs/architecture-examples/cujo/index.html#L12) (the other one is required by todomvc)

In production, you will typically use cram (https://github.com/cujojs/cram) to build your application into a single javascript file, or a small number of bundle files, each containing many modules.  When building to a single javascript file, you'll typically deploy that file as "run.js" and not have to change your index.html at all--it'll just work.  Building a multi-bundle application is a more advanced topic, and we plan to provide more examples of that at some point.

Hope that helps!

unscriptable

unread,
Jun 24, 2013, 12:48:40 PM6/24/13
to cuj...@googlegroups.com
Hello Ged Wed,

Do you want to hide the script elements at design time or run time?  Can you elaborate?

Thanks.

-- John


On Sunday, June 23, 2013 9:38:34 AM UTC-4, Ged Wed wrote:
Reply all
Reply to author
Forward
0 new messages