我正在尝试找出为我的 (SASS) CSS 资产提供服务的最佳实践方式。我用谷歌搜索和谷歌搜索,现在我的想法令人难以置信!
导轨 3.2.15
宝石文件:
# Asset pipeline
group :assets do
gem 'sass-rails', '3.2.6'
gem 'coffee-rails', '3.2.2'
gem 'uglifier', '2.3.0'
end
生产.rb
# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = false
# Compress JavaScripts and CSS
config.assets.compress = true
# Don't fallback to assets pipeline if a precompiled asset is missed
config.assets.compile = false
# Generate digests for assets URLs
config.assets.digest = true
# Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
config.assets.precompile += %w( *.js *.css )
# Choose which compressors to use
# config.assets.js_compressor = :uglifier
# config.assets.css_compressor = :scss
应用程序.css.scss
/*
*= require data_tables
*= require data_tables_colvis
*= require styles
*= require jquery.ui.autocomplete
*= require jquery.ui.datepicker
*= require jquery.ui.slider
*= require timepicker
*= stub email
*= require_directory
*/
.ui-widget,
.ui-widget input,
.ui-widget select,
.ui-widget textarea,
.ui-widget button { font-family: inherit; font-size: inherit; }
请注意,我require
在其中的一些文件,app/assets/stylesheets
而其他文件在vendor/assets/stylesheets
命令运行
rm -rf tmp/
rm -rf public/assets/
bundle exec rake assets:clean RAILS_ENV=production --trace
bundle exec rake assets:precompile RAILS_ENV=production --trace
遇到错误
** Invoke assets:precompile:all (first_time)
** Execute assets:precompile:all
** Invoke assets:precompile:primary (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Invoke tmp:cache:clear (first_time)
** Execute tmp:cache:clear
** Execute assets:precompile:primary
rake aborted!
Operation not supported - (/media/shared/code/user/appname/tmp/cache/sass/21e55874b33b09754ee1326254c109e623619141/application.css.scssc20131108-41651-yzw3cr, /media/shared/code/user/appname/tmp/cache/sass/21e55874b33b09754ee1326254c109e623619141/application.css.scssc)
(in /media/shared/code/user/appname/app/assets/stylesheets/application.css.scss)
/usr/lib/ruby/gems/1.9.1/gems/sass-3.2.12/lib/sass/util.rb:886:in `rename'
/usr/lib/ruby/gems/1.9.1/gems/sass-3.2.12/lib/sass/util.rb:886:in `atomic_create_and_write_file'
临时文件路径上的尾随c
对我来说似乎有点可疑?
有什么想法吗?这样做的“正确”方法是什么?
谢谢