Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
be24be62
R
rails
项目概览
张重言
/
rails
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rails
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
be24be62
编写于
9月 09, 2011
作者:
S
Santiago Pastorino
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2876 from alex3/patch-1
Fixed assets precompile regex
上级
f43ffdcb
901c02d8
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
32 addition
and
1 deletion
+32
-1
actionpack/lib/sprockets/assets.rake
actionpack/lib/sprockets/assets.rake
+2
-0
railties/lib/rails/application/configuration.rb
railties/lib/rails/application/configuration.rb
+2
-1
railties/test/application/assets_test.rb
railties/test/application/assets_test.rb
+28
-0
未找到文件。
actionpack/lib/sprockets/assets.rake
浏览文件 @
be24be62
...
...
@@ -26,6 +26,8 @@ namespace :assets do
env
.
each_logical_path
do
|
logical_path
|
if
path
.
is_a?
(
Regexp
)
next
unless
path
.
match
(
logical_path
)
elsif
path
.
is_a?
(
Proc
)
next
unless
path
.
call
(
logical_path
)
else
next
unless
File
.
fnmatch
(
path
.
to_s
,
logical_path
)
end
...
...
railties/lib/rails/application/configuration.rb
浏览文件 @
be24be62
...
...
@@ -37,7 +37,8 @@ def initialize(*)
@assets
=
ActiveSupport
::
OrderedOptions
.
new
@assets
.
enabled
=
false
@assets
.
paths
=
[]
@assets
.
precompile
=
[
/\w+\.(?!js|css).+/
,
/application.(css|js)$/
]
@assets
.
precompile
=
[
Proc
.
new
{
|
path
|
!
File
.
extname
(
path
).
in?
([
'.js'
,
'.css'
])
},
/application.(css|js)$/
]
@assets
.
prefix
=
"/assets"
@assets
.
version
=
''
@assets
.
debug
=
false
...
...
railties/test/application/assets_test.rb
浏览文件 @
be24be62
...
...
@@ -64,6 +64,34 @@ def app
end
end
test
"precompile application.js and application.css and all other files not ending with .js or .css by default"
do
app_file
"app/assets/javascripts/application.js"
,
"alert();"
app_file
"app/assets/stylesheets/application.css"
,
"body{}"
app_file
"app/assets/javascripts/something.min.js"
,
"alert();"
app_file
"app/assets/stylesheets/something.min.css"
,
"body{}"
images_should_compile
=
[
"a.png"
,
"happyface.png"
,
"happy_face.png"
,
"happy.face.png"
,
"happy-face.png"
,
"happy.happy_face.png"
,
"happy_happy.face.png"
,
"happy.happy.face.png"
,
"happy"
,
"happy.face"
,
"-happyface"
,
"-happy.png"
,
"-happy.face.png"
,
"_happyface"
,
"_happy.face.png"
,
"_happy.png"
]
images_should_compile
.
each
do
|
filename
|
app_file
"app/assets/images/
#{
filename
}
"
,
"happy"
end
capture
(
:stdout
)
do
Dir
.
chdir
(
app_path
){
`bundle exec rake assets:precompile`
}
end
images_should_compile
.
each
do
|
filename
|
assert
File
.
exists?
(
"
#{
app_path
}
/public/assets/
#{
filename
}
"
)
end
assert
File
.
exists?
(
"
#{
app_path
}
/public/assets/application.js"
)
assert
File
.
exists?
(
"
#{
app_path
}
/public/assets/application.css"
)
assert
!
File
.
exists?
(
"
#{
app_path
}
/public/assets/something.min.js"
)
assert
!
File
.
exists?
(
"
#{
app_path
}
/public/assets/something.min.css"
)
end
test
"asset pipeline should use a Sprockets::Index when config.assets.digest is true"
do
add_to_config
"config.assets.digest = true"
add_to_config
"config.action_controller.perform_caching = false"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录