Rails gem package css javascript to enhance site performance jammit Introduction

2010-08-02  来源:本站原创  分类:Ruby  人气:206 

Recommend a gem jammit
Official hub

Installation

gem install jammit

#environment.rb
config.gem "jammit"

Rails2 need to modify the config / routes.rb add the path, Rails can not

ActionController::Routing::Routes.draw do |map|
  ...
  Jammit::Routes.draw(map)
  ...
end

Configuration

#config/assets.yml
embed_assets: on

rubyscripts:
  workspace:
    - public/rubyscripts/vendor/jquery.js
    - public/rubyscripts/lib/*.js
    - public/rubyscripts/views/**/*.js
    - app/views/workspace/*.jst

stylesheets:
  common:
    - public/stylesheets/reset.css
    - public/stylesheets/widgets/*.css
  workspace:
    - public/stylesheets/pages/workspace.css
  empty:
    - public/stylesheets/pages/empty.css

Use

<%= include_stylesheets :common, :workspace, :media => 'all' %>
<%= include_rubyscripts :workspace %>

If the development environment, do not want to resume loading

# ApplicationController

before_filter { Jammit.packager.precache_all } if Rails.env.development?

There are some good configuration, you can reference to use.

相关文章
  • Rails gem package css javascript to enhance site performance jammit Introduction 2010-08-02

    Recommend a gem jammit Official hub Installation gem install jammit #environment.rb config.gem "jammit" Rails2 need to modify the config / routes.rb add the path, Rails can not ActionController::Routing::Routes.draw do |map| ... Jammit::Routes.d

  • HTML, CSS, Javascript in iPhone (transferred from koubei F2E good friend) 2010-09-15

    The original link is as follows: http://www.slideshare.net/supersha/htmlcssjavascript-in-iphone HTML, CSS, Javascript in iPhone - Presentation Transcript 1. Koubei F2E good friends 2010.04.20 2. 3. IPhone 3G S 4. Fell in love with the reasons for iPh

  • CSS + JavaScript Tab panel production 2010-08-26

    This is what I have just learned to do with CSS + JavaScript Tab panel with a simple, doing many problems, but after efforts to resolve, and now share with you, If anyone has a better way to do Tab panel I can teach about, first Thank you!

  • Change the front control code-behind CSS, javascript events to increase 2010-11-27

    WebControl class has a property: Attributes (acquisition and control of the property does not correspond to any feature (only for rendering) of the collection.) Property value name and value pairs AttributeCollection. This property can be changed thr

  • 用html css javascript打造自己的RIA图文教程第1/2页 2014-12-31

    用html&css&javascript打造自己的RIA之一,包括了配置等 在制作之前,先建立开发环境. 打开netbeans6.1,在项目工作区,右击新建项目,选择Web目录下的Web应用程序. 项目名称输入 RIADemo . 选择运行的服务器以及 java ee 标准. 在这里选择tomcat5.0,j2ee1.4,本文介绍例子,并不依赖于服务器,因为html&css&javascript本身都是静态的,做完以后就是一个html文件.严格意义上的web程序肯定是要有一

  • 网页性能之Html Css Javascript 2015-02-05

    前言 html css javascript可以算是前端必须掌握的东西了,但是我们的浏览器是怎样解析这些东西的呢 我们如何处理html css javascript这些东西来让我们的网页更加合理,在我这里做了一些实验,总结起来给大家看看. 最简单的页面 <!DOCTYPE html> <html> <head> <title>test</title> </head> <body> <img src="dow

  • HTML/CSS/Javascript代码在线压缩.格式化(美化)工具 2015-02-25

    HTML/CSS/Javascript代码在线压缩.格式化(美化)工具 CSS 格式化 ProCSSor -http://procssor.com/ CSS 压缩 CSS Compressor -http://www.cssdrive.com/index.php/main/csscompressor HTML 格式化 Tabifier -http://tools.arantius.com/tabifier HTML 压缩 Compress HTML -http://www.textfixer.c

  • 实现css+javascript多风格切换实例 2011-06-30

    今天四夕从OECP社区给大家转载一篇文章<实现css+javascript多风格切换实例>,本人觉得很有用,希望可以对大家有帮助! 现在大部分的网站都只有一个风格,一种布局,不会根据用户的喜好.习惯来选择自己喜欢的风格模板.这样也不至于使网站呆板,不及时更新.如果来切换风格来看同一个网站会带给用户不一样的体验.这样的风格可以是布局上的变化,也可以是色彩上的差异.就是相当于不同的模板,内容是相同的. 该如何实现多风格选择与样式的实时切换呢?本篇文章:"实现css+javascript多

  • 一个HTML/CSS/Javascript的在线开发工具 - Fiddle Salad 2012-04-10

    日期:2012-4-9 来源:GBin1.com 今天我们给大家带来一个超棒的HTML/CSS/Javascript的在线开发工具 - Fiddle Salad,如果你使用过jsfiddle的话,相信大家会更喜欢这个功能强大的在线整合开发环境. 和jsfiddle类似,你也可以使用Fiddle Salad来在线调试javascript/html/css,让我感觉更好的地方在于Fiddle Salad能 够提供IDE的自动补齐功能,如果你输入javascript, html标签或者css标签时,这

  • 利用CSS.JavaScript及Ajax实现图片预加载的三大方法 2014-09-04

    发表于2013-10-15 16:17| 来源Perishable Press| 作者Perishable Press 摘要:图片的加载速度往往影响着网站整体的用户体验,尤其对于包含大量图片的网站.对图片进行预加载,不失为一个高效的解决方案.如何实现预加载?本文将例举利用CSS.JavaScript及Ajax实现图片预加载的三大方法. Perishable Press网站近日发表了一篇文章<3 Ways to Preload Images with CSS, JavaScript, or Aja

  • Records - Notes-html-web site performance optimization 2010-07-06

    A WEB site performance tuning, Preface: In the development of increasingly sophisticated technological age, using software to solve their daily work, life and even entertainment, friends have become a very common thing. With the rapid development of

  • What is a reverse proxy, how to use reverse proxy to improve site performance 2010-10-21

    Often see these days talking about in the blog kangzj agent, the article notes also mentioned reverse proxy, and some students use the absolute path of the accelerated play around ghs not quite understand, then to summarize the knowledge of the rever

  • Waterfall initial diagnosis using the Web site performance bottlenecks .. 2011-06-16

    Core Tip: In general, the speed of opening a web page will be the following effects: 1) The server took too long to be dynamic page content into html. 2) dynamic pages took too long to send content from the server to the client. 3) page <! - News tex

  • (Rpm) using squid reverse proxy to improve site performance 2011-04-28

    Article Category: Web front-end text: http://www.ibm.com/developerworks/cn/linux/l-cn-squid/ This paper describes the working principle of squid reverse proxy based on that reverse proxy technology to improve site access speed, enhanced usability, se

  • Transferred from site performance optimization summary 2010-06-04

    Summary transferred from site performance optimization. 1. To use stored procedures (if stored in a program with the exec process parameters, such implementation does not seem much faster) is pre-compiled in the database, nor need to spend a lot of t

  • Development of high-performance web site performance testing tool 2010-06-22

    WEB performance test tool is divided into three types, one is to test the speed of page loads of resources, one is a test page has finished loading the page rendering, JS operating speed, there is a page of an overall evaluation on the analysis of Th

  • Comprehensively enhance the performance of Web 2.0 applications, Part 3: Analysis of the browser rendering time 2010-08-03

    Who is the longest running time of the call method? Simplified browser response time calculation model Browser, server response time, response time = time + page + page load time rendering Page rendering time = time + script execution time the browse

  • WEB site performance of large data solutions 2010-08-22

    With the large IT companies accelerate the speed of information, most of the applications and data traffic are rapidly increasing, large enterprises are facing Web site performance and high data traffic pressure, but also for storage, security and in

  • Detailed site performance optimization video 2011-03-03

    Website performance optimization of data in more detail, can serve as a reference entry The meaning of site optimization website optimization itself, the performance of seo also played an important role, but methods to enhance web performance in a sm

  • SEO methods to enhance the performance of short 2011-06-22

    The constant practice of the past few years to try to summarize some of the common ways to help seor establish a suitable approach, but gradually to understand the principle, if the method is generic so that he will in a very short period of time has