Javascriptmvc tutorial-6. Getting started with javascriptmvc-compression and docalization cookbook

Source: Internet
Author: User

  Compress cookbook

When downloading many JS files, it will bring a lot of overhead. The server can use simple compression technology to link the files to a file.

  Compression script

  Use the following command to compress your program's Js script:

C:\workspace\Cookbook>js cookbook\scripts\build.js

My local running results:

Then check whether there is a production. js file under the cookbook folder.

 

  Switch to production mode

Use the scripts tag of steal on the page and change it to steal. Production. js to switch the production mode, as shown below:

<script type='text/javascript' src='../steal/steal.production.js?cookbook'></script>

 

  Reload and confirm

Refresh the page and load only two JS files: steal. Production. js and production. js. This is much better than loading 28 files in development mode.

 

  Docized cookbook

The document is very important for the maintainability code, but it will increase the work of developers, so it is often ignored. Javascriptmvc integrates documentjs to reduce this workload.

 

  Generate document

Use the following command to generate a document:

> js cookbook/scripts/docs.js

  Note: Make sure that cookbook.html is not in the production environment before running the command.

Local running result:

 

  View document

Open the cookbook/doc.html page and you will see the following content:

 

  Write document

The generated application only has a small document. Open cookbook/cookbook. md. Its syntax is similar to javadoc, but it is quite different. You can learn more in documentjs's documentation.

 

Javascriptmvc tutorial directory

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.