Include Scripts

S

shapper

Hello,

I am working on a web site where I have a master page.
Most web site pages use this master page as base.

Some scripts are used in all pages ... other just in a few pages.
Should I load all scripts in master page ... I think they are cached
right?

Or should I load the common scripts to all pages in my master page and
then in each page load the scripts that are not used in all pages?

Thanks,
Miguel
 
C

Cowboy \(Gregory A. Beamer\)

In general, I prefer an "as needed" approach, which would mean only the
scripts that belong in all pages go in the main master. This will add a bit
more work in setting up the pages, but will prevent overloading your users.

If your pages are easily segmented, you can use a master page hierarchy and
add scripts as needed, but this could be a maintenance nightmare.

Putting all in one master is the easiest option, from your side. But, if
your users are on a slow connection, it could be a nightmare for them, as
all the scripts have to be downloaded to get things working.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************
 
S

shapper

In general, I prefer an "as needed" approach, which would mean only the
scripts that belong in all pages go in the main master. This will add a bit
more work in setting up the pages, but will prevent overloading your users.

If your pages are easily segmented, you can use a master page hierarchy and
add scripts as needed, but this could be a maintenance nightmare.

Putting all in one master is the easiest option, from your side. But, if
your users are on a slow connection, it could be a nightmare for them, as
all the scripts have to be downloaded to get things working.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my bloghttp://feeds.feedburner.com/GregoryBeamer#

or just read it:http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box!                               |

Is there any tool that merges various Javascript files into one single
file and minifies it?

I suppose that would be the best solution. Then I would use that file
on production mode ...

Thanks,
Miguel
 
C

Cowboy \(Gregory A. Beamer\)

Is there any tool that merges various Javascript files into one single
file and minifies it?

None that I know of. Combining the files should not be hard. To make it as
small as possible, you can create a small tool that reads each line and
removes the carriage returns along with any spaces larger than one space.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top