BOOTSTRAPCDN and Localization

Source: Internet
Author: User
Tags jquery library

Because the company's network environment is poor and the reason for their rookie, very simple things toss a lot of time. Testing the development of the page when the update is always slow, which is related to the use of BOOTSTRAPCDN, because each update, it will have to revisit the cdn.bootstrap.com again, so it needs response time. If the network is fast, of course, you do not need to localize, or localize the resource files, you do not have to endure each response for a long time.

(a) Building BOOTSTAP environment

You can add <link> and <script> in the

1   <Linkhref= "//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css"rel= "stylesheet">2 3   <Scriptsrc= "//cdn.bootcss.com/jquery/2.1.4/jquery.min.js"></Script>4   <Scriptsrc= "//cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></Script>

This order cannot be changed because bootstrap.min.js needs to invoke the jquery library, so the jquery.min.js should precede it.

(ii) Localization of the BOOTSTAP environment

Sometimes the network a little card, refresh the page slowly, the impact of web development mode, the solution to this impatient little problem is to localize these libraries. when localizing, also keep the above order.

(1) jquery library, downloaded directly from the official website, placed in a directory, for example: the jquery folder stored in the project example, then

<script src= "/example/jquery/jquery.min.js"></ Script>

Can

(2) The bootstrap framework is relatively complex, because to invoke the buttons provided by bootstrap itself, if there are only Bootstrap.min.css and bootstrap.min.js, it can cause some problems. For example, obviously add a button to the code, but there is nothing in the Web page, excluding errors such as error. Calling the bootstrap button in the Web page requires additional resource files, which can only be used if you add them all. To call the button For example, you need to download bootstrap, and then find the Dict folder, the inside of all the folders (there will be css,js,fonts) copy to the project example new Folder Boostrap. When you need to use a button, the system automatically inquiries relative paths to collect the required content.

PS: If other calls, copy the entire folder to the project and add external access.

(iii) Localization of the addition of external resources

For example, I would like to use Fondawesome (official website, Chinese network) some resources, in addition to the most concise way BOOTSTRAPCDN

< link href= "//netdna.bootstrapcdn.com/font-awesome/4.4.0/css/ Font-awesome.min.css " rel=" stylesheet ">

Outside

Localization:

    • Copy the entire font-awesome folder into your project.
    • Reference font-awesome.min.css in the HTML .
        <link rel="stylesheet" href="path/to/font-awesome/css/font-awesome.min.css"> 

BOOTSTRAPCDN and Localization

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.