• Like
  • Save
Asset Pipeline
Upcoming SlideShare
Loading in...5
×
 

Asset Pipeline

on

  • 1,443 views

Accompanying slides for presentation done at Utah Ruby User Group.

Accompanying slides for presentation done at Utah Ruby User Group.

Statistics

Views

Total Views
1,443
Views on SlideShare
1,440
Embed Views
3

Actions

Likes
1
Downloads
6
Comments
0

3 Embeds 3

http://www.hanrss.com 1
http://coderwall.com 1
http://www.linkedin.com 1

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n

Asset Pipeline Asset Pipeline Presentation Transcript

  • Asset Pipeline for dummies
  • Why?
  • Precompile
  • Concatenate
  • Minify
  • Sprockets performs the asset packaging which takes the assets from all thespecified paths, compiles them together and places them in the target path(public/assets).
  • Tilt is the template engine that Sprockets uses. This allows file types like scssand erb to be used in the asset pipeline.
  • Files in Asset PathsAssetPipeline
  • Asset Paths
  • app/assets is for assets that are owned by the application, such as custom images, JavaScript files or stylesheets.
  • app/assets is for assets that are owned by the application, such as custom images, JavaScript files or stylesheets.lib/assets is for your own libraries’ code that doesn’t really fit into the scope of the application or those libraries which are shared across applications.
  • app/assets is for assets that are owned by the application, such as custom images, JavaScript files or stylesheets.lib/assets is for your own libraries’ code that doesn’t really fit into the scope of the application or those libraries which are shared across applications.vendor/assets is for assets that are owned by outside entities, such as code for JavaScript plugins and CSS frameworks.
  • the manifest
  • • require [path] inserts the contents of the asset source file specified by path. If the file is required multiple times, it will appear in the bundle only once.
  • • require [path] inserts the contents of the asset source file specified by path. If the file is required multiple times, it will appear in the bundle only once.• include [path] works like require, but inserts the contents of the specified source file even if it has already been included or required.
  • • require [path] inserts the contents of the asset source file specified by path. If the file is required multiple times, it will appear in the bundle only once.• include [path] works like require, but inserts the contents of the specified source file even if it has already been included or required.• require_directory [path] requires all source files of the same format in the directory specified by path. Files are required in alphabetical order.
  • • require [path] inserts the contents of the asset source file specified by path. If the file is required multiple times, it will appear in the bundle only once.• include [path] works like require, but inserts the contents of the specified source file even if it has already been included or required.• require_directory [path] requires all source files of the same format in the directory specified by path. Files are required in alphabetical order.• require_tree [path] works like require_directory, but operates recursively to require all files in all subdirectories of the directory specified by path.
  • • require [path] inserts the contents of the asset source file specified by path. If the file is required multiple times, it will appear in the bundle only once.• include [path] works like require, but inserts the contents of the specified source file even if it has already been included or required.• require_directory [path] requires all source files of the same format in the directory specified by path. Files are required in alphabetical order.• require_tree [path] works like require_directory, but operates recursively to require all files in all subdirectories of the directory specified by path.• require_self tells Sprockets to insert the body of the current source file before any subsequent require or include directives.
  • • require [path] inserts the contents of the asset source file specified by path. If the file is required multiple times, it will appear in the bundle only once.• include [path] works like require, but inserts the contents of the specified source file even if it has already been included or required.• require_directory [path] requires all source files of the same format in the directory specified by path. Files are required in alphabetical order.• require_tree [path] works like require_directory, but operates recursively to require all files in all subdirectories of the directory specified by path.• require_self tells Sprockets to insert the body of the current source file before any subsequent require or include directives.• depend_on [path] declares a dependency on the given path without including it in the bundle. This is useful when you need to expire an asset’s cache in response to a change in another file.
  • • require [path] inserts the contents of the asset source file specified by path. If the file is required multiple times, it will appear in the bundle only once.• include [path] works like require, but inserts the contents of the specified source file even if it has already been included or required.• require_directory [path] requires all source files of the same format in the directory specified by path. Files are required in alphabetical order.• require_tree [path] works like require_directory, but operates recursively to require all files in all subdirectories of the directory specified by path.• require_self tells Sprockets to insert the body of the current source file before any subsequent require or include directives.• depend_on [path] declares a dependency on the given path without including it in the bundle. This is useful when you need to expire an asset’s cache in response to a change in another file.• stub [path] allows dependency to be excluded from the asset bundle. The path must be a valid asset and may or may not already be part of the bundle. Once stubbed, it is blacklisted and can’t be brought back by any other require.
  • usage
  • Misconceptions
  • Files must belong in their respective paths.For example, all JavaScript files must be in a javascripts folder within anasset path.
  • Files must belong in their respective paths.For example, all JavaScript files must be in a javascripts folder within anasset path.The truth is that the paths (stylesheets, javascripts,images) are only there for organization.You can haveall the assets in a single folder or in a hundred.
  • Sass files need to use *erb* extension to allow for asset path inclusionswithin the files.
  • Sass files need to use *erb* extension to allow for asset path inclusionswithin the files.The truth is that sass-rails provides -url and-path helpers for the following asset types: image,font, video, audio, JavaScript and stylesheet.
  • gems
  • faq
  • Why doesnt the auto-generated scss and coffeescriptonly get included in their respective controller views?
  • Why doesnt the auto-generated scss and coffeescriptonly get included in their respective controller views?
  • Do I have to use the asset pipeline?
  • Do I have to use the asset pipeline?
  • What happens if there are duplicate file names in different asset folders?
  • What happens if there are duplicate file names in different asset folders?
  • How can I precompile assets that arent to be used in the pipeline?
  • How can I precompile assets that arent to be used in the pipeline?
  • How can I precompile additional assets without having to include them in the manifest?
  • How can I precompile additional assets without having to include them in the manifest?
  • PrecompileConcatenate Minify
  • http://coderberry.me