对javascript和css打包 有什么好用的插件吗?

2 views
Skip to first unread message

blade

unread,
Aug 18, 2011, 2:12:21 AM8/18/11
to Rails Wednesday
以前都通过
<%= javascript_include_tag "xxxx", "xxxx" :cache => "xxx_package" %>
<%= stylesheet_link_tag 'xxx', "xxxx", :cache => "xxx_package" %>

来合并多个js,css文件。如果其中有文件修改了 需要把cache的文件删除 重新生成。所以部署的时候都会把这些cache文件删除了。

但是nginx设置了

location ~ ^/(images|javascripts|stylesheets)/ {
root /home/app/apps/redmine/current/public;
expires 30d;
}

这个静态文件的请求就没有发到rails进程, 就不会自动生成这些文件,导致页面加载文件404。
有人 用过 给js,css打包的插件吗?

huang zhimin

unread,
Aug 19, 2011, 5:40:56 AM8/19/11
to rail...@googlegroups.com
js, css的链接没有带?xxxxxx的?

2011/8/18 blade <yak...@gmail.com>



--
Best regards,
Richard Huang
flye...@gmail.com

http://www.huangzhimin.com
@flyerhzm

Blade Yu

unread,
Aug 19, 2011, 5:39:35 AM8/19/11
to rail...@googlegroups.com
哈哈 xxx 只是个例子,xxx 就是普通的js文件名。

-- 
Blade Yu
Sent with Sparrow

yuanyi zhang

unread,
Aug 19, 2011, 6:48:57 AM8/19/11
to rail...@googlegroups.com
升到3.1吧,或者试试3.1里面的sprockets和uglifier

2011/8/18 blade <yak...@gmail.com>

Andy

unread,
Aug 19, 2011, 8:00:29 AM8/19/11
to rail...@googlegroups.com
@yuanyi +1


2011/8/19 yuanyi zhang <zhang...@gmail.com>

wxianfeng

unread,
Aug 24, 2011, 11:19:50 PM8/24/11
to Rails Wednesday
我们使用的是 yuicompressor.jar工具 不过需要java环境 , 压缩率比较高, <构建高性能javascript>一书有介
绍,另外 jquery 压缩版也是用这个压宿的


>
>
>
>
> > 升到3.1吧,或者试试3.1里面的sprockets和uglifier
>
> > 2011/8/18 blade <yakj...@gmail.com>

Blade Yu

unread,
Aug 24, 2011, 11:20:12 PM8/24/11
to wxianfeng, Rails Wednesday
试了一下 确实很棒啊,可以用这个,如果做成rails的一个插件 就更好用了。

-- 
Blade Yu
Sent with Sparrow
--
You received this message because you are subscribed to the Google Groups "Rails Wednesday" group.
To post to this group, send email to rail...@googlegroups.com.
To unsubscribe from this group, send email to railswed+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/railswed?hl=en.

Reply all
Reply to author
Forward
0 new messages