2. Objects
• Css (SaSS)
• Javascript (coffeescript)
• Images
• Fonts
• other files...
суббота, 6 октября 12 г.
3. Why?
• Compressing up to 80%
суббота, 6 октября 12 г.
4. Why?
• Caching (with digests)
суббота, 6 октября 12 г.
5. Assets folders
• app/assets/
• lib/assets
• vendor/assets
суббота, 6 октября 12 г.
6. Assets folder structure
• app/assets/ or lib/assets or
vendor/assets
• stylesheets
• javascripts
• images
• your own folder (for example fonts)
суббота, 6 октября 12 г.
7. Main files
file1.js
included application.js
file2.js
суббота, 6 октября 12 г.
8. application.js
• //= require jquery
• //= require jquery_ujs
• //= reauire_tree .
суббота, 6 октября 12 г.
9. Including assets to
views
• javascript_include_tag
• stylesheet_include_tag
• image_tag
• asset_path
суббота, 6 октября 12 г.
11. Gems for compressing
• closure
• uglifier (default)
• yui
суббота, 6 октября 12 г.
12. When compile?
• Only in production mode
• In development just make sure that:
rake assets:precompile works
• Always clean assets in development mode:
rake assets:clean
суббота, 6 октября 12 г.
13. Where?
• Production server
• Content Delivery Network (CDN)
• Just other server (your own CDN)
суббота, 6 октября 12 г.
14. Workflows: 1
• run rake assets:precompile in
development mode
• push compiled assets (/public/assets) to
CDN
• push your new code to the production
server
суббота, 6 октября 12 г.
15. Workflows: 2
• Push code to production server
• Precompile assets on the server
• Push assets to the CDN
суббота, 6 октября 12 г.
16. Production release
structure
CDN (Content Production server
Delivery Network)
Development
machine
суббота, 6 октября 12 г.
17. Famous CDNs
• Amazon S3
• Rackspace
суббота, 6 октября 12 г.
18. Tools to pushing assets
to CDN
• asset_sync (we will use it)
• jammit_s3
• others
суббота, 6 октября 12 г.
19. Q/A?
• http://github.com/ka8725
• http://twitter.com/@ka8725
суббота, 6 октября 12 г.