久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

管理 jQuery 插件

Managing jQuery Plugins(管理 jQuery 插件)
本文介紹了管理 jQuery 插件的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

通常,在使用 jQuery 時,需要包含多個插件.這很快就會變得雜亂無章,尤其是當某些插件需要額外的組件(圖像和 CSS 文件)時.

Often, when working with jQuery, the need arises to include multiple plugins. This can quickly become messy work, especially when some plugins require additional components (images and CSS files).

有哪些推薦"方法:

  • a. 以易于維護的方式管理所需的文件/組件(.js.css 和圖像),和;
  • b. 將這些插件包更新到最新版本
  • a. Manage the required files/components (.js, .css and images) in a way that is easy to maintain, and;
  • b. Keep these plugin packages updated to the latest versions

我不一定要尋找一種工具來執行此操作(盡管我認為可以執行此管理的工具會很有用),但更多的是一種思維方式.

I'm not necessarily looking for a tool to do this (although one that could perform this management would be useful, I suppose), but more of a way of thinking.

推薦答案

更新:這幾天有 Bower、組件和Browserify 它會自動為我們處理以下所有事情.

Update: These days there is Bower, Component and Browserify which take care of all of the following for us automatically.

我很驚訝還沒有人報道我所做的事情.下面是我管理腳本和資源的方式.

I'm surprised no one has covered what I do yet. So here's how I manage scripts and resources.

我使用 SVN 進行設置的每個項目.我包含的幾乎所有腳本都有一個 SVN 鏡像(這些天 github 有 svn),這意味著我可以使用 SVN 外部并將該項目的任何分支或版本或我想要的任何內容直接獲取到項目 scripts文件夾.由于我們使用的是 SVN,因此很容易跟蹤、管理和更新這些腳本.

I have each project I work on setup with SVN. Nearly all of the scripts I include have a SVN mirror (github has svn these days) this means that I can then use SVN externals and fetch whatever branch or version or whatever I want of that project directly into the projects scripts folder. As we are using SVN, it is easy to track, manage and update these scripts.

如果一個項目不在SVN上,那么我只需將它添加到我制作的普通SVN項目中,例如項目A和項目B,都使用jquery-project-not-in-svn,所以我們將 jquery-project-not-in-svn 粘貼到我們公共項目的 SVN 存儲庫中,然后在項目 A 和 B 上使用 SVN 外部來引用它 - 如前所述.

If a project is not on SVN, then I just add it to a common SVN project I have made, so for instance Project A and Project B, both use jquery-project-not-in-svn, so we stick jquery-project-not-in-svn into our common project's SVN repository, and then use SVN externals on Projects A and B to reference it - as explained before.

現在涵蓋了管理、獲取和更新.

Now that covers managing, fetching and updating.

以下是我介紹腳本包含和請求的方式.

Here is how I cover script inclusions and requests.

由于每個項目現在都有自己的腳本目錄,其中包含它需要的所有腳本(由 SVN 外部管理),我們現在必須擔心縮小它們以減少服務器上的負載.每個項目的根目錄中都有一個 Makefile,其中包含命令 update.該命令將執行以下操作:

As each project now has it's own scripts directory that contains all the scripts it needs (which is managed by SVN externals), we now have to worry about minifying them to reduce load on our server. Each project has a Makefile in it's root, which contains the command update. This command will perform the following:

  • 執行 SVN 更新(這將適當地更新所有 SVN 外部)
  • 完成后,它將所有 js 文件打包并縮小為 scripts/all.jsscripts/all.min.js

我無法分享確切的 Makefile,但我可以分享一個處理 CSS 和 Javascript 的打包/合并和縮小的公共文件.鏈接在這里:http://github.com/balupton/jquery-sparkle/blob/9921fcbf1cbeab7a4f2f875a91cb854生成文件

I can't share the exact Makefile but I can share one which is public that handles packing/merging and minification of CSS and Javascript. Here is the link: http://github.com/balupton/jquery-sparkle/blob/9921fcbf1cbeab7a4f2f875a91cb8548f3f65721/Makefile

通過做這些事情,我們實現了:

By doing these things, we have achieved:

  • 管理多個項目的外部腳本資源
  • 自動更新適當的腳本資源
  • 將項目所有用到的腳本資源打包到一個文件中
  • 縮小該文件,以便只執行一個 JS 請求和一個 CSS 請求.

祝你好運,如果您想了解更多信息,請隨時發表評論.

So good luckmate, feel free to post a comment if you would like to learn more.

這篇關于管理 jQuery 插件的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

jQuery/JavaScript Library for avatar creation?(用于創建頭像的 jQuery/JavaScript 庫?)
How to do following mask input problem?(如何做以下掩碼輸入問題?)
Issues Setting Value/Label Using DropKick Javascript(使用 DropKick Javascript 設置值/標簽的問題)
how to unit-test private methods in jquery plugins?(如何對 jquery 插件中的私有方法進行單元測試?)
stellar.js - configuring offsets / aligning elements for a vertical scrolling website?(stellar.js - 為垂直滾動網站配置偏移量/對齊元素?)
jQuery masked input plugin. select all content when textbox receives focus(jQuery 屏蔽輸入插件.當文本框獲得焦點時選擇所有內容)
主站蜘蛛池模板: 欧美电影免费观看高清 | 99精品久久99久久久久 | 91中文字幕在线 | 亚洲三区在线观看 | 欧美精品99| 一级黄片一级毛片 | 国产激情在线 | 亚洲国产精品一区二区久久 | 成人日b视频 | 国产色黄 | 日韩中文字幕免费在线 | 色毛片| 欧美视频一区二区三区 | 蜜桃免费一区二区三区 | 成人免费观看男女羞羞视频 | 国精品一区 | 天天操 夜夜操 | 国产精品久久久久久福利一牛影视 | 日韩一二三| 欧美日韩综合视频 | 欧美国产精品一区二区三区 | 四虎影院一区二区 | 夜夜艹 | 日韩在线播放中文字幕 | 国产精品69毛片高清亚洲 | 欧美在线视频一区二区 | 欧美一区二区三区在线观看 | a级片在线观看 | 在线免费观看日本视频 | 成人福利网 | 天天激情综合 | 久久国产精品99久久久久 | 91久久国产综合久久 | 欧美黑人国产人伦爽爽爽 | 亚洲精品av在线 | 国产精品欧美一区二区 | 免费一区 | 中文字幕久久久 | 中文字幕一区在线观看视频 | 国产精品成人国产乱 | 久久一级免费视频 |