sf-wdi-22-23 / asset_pipeline_poem

Organize your assets to read the poem!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Asset Pipeline Poem

Objectives
Explore the assets pipeline in rails
Practice structuring require statements
Precompile compressed javascript assets

Terms:

  • Manifest
  • Pre/compilation
  • Concatenation
  • Compression / Minification
  • Browser Caching
  • MD5 fingerprint

##Instructions: Your goal is to reconstruct a simple poem.

  • Clone this repo
    • Note that this rails app does not have a database.
  • Run your server and open "/". You should see a jumbled poem.

When you're done make changes, the homepage should look like this (with the poem in the correct order and styled correctly):

goal

Rules

  • You are not allowed to modify any files.
  • You are only allowed to update the manifests in:
    • app/assets/javascripts/application.js
      • e.g. //= require roses-are-red
    • app/assets/stylesheets/application.css
      • e.g. *= require layout
  • Try not to use require_tree . anywhere.

Part 1. Using the Asset Pipeline

The assets you want live in the following locations, inside of your rails application directory:

app/                    # application specific code
    assets/
        images/
        javascripts/
        stylesheets/
lib/                    # custom libraries
    assets/
        javascripts/
        stylesheets/
vendor/                 # third party libraries
    assets/
        javascripts/
        stylesheets/

Each directory has a specific use-case. The files you want are scattered across them. Your goal is to find all the files and require them in the correct order!

##Bonuses: Note that bootstrap.js is being included using a CDN. It's a quick and dirty way of including it, but let's save it locally:

  1. Find and copy the current bootstrap.js url (see views/layouts/application.html.erb)
  2. cd vendor/assets/javascripts/
  3. curl -vs BOOTSTRAP_JS_URL > bootstrap.js
  4. Finally, delete the old cdn link, and "require" the new bootstrap in your application.js manifest.

##Reading http://guides.rubyonrails.org/asset_pipeline.html https://github.com/rails/sprockets#sprockets-directives

About

Organize your assets to read the poem!


Languages

Language:Ruby 69.7%Language:HTML 20.2%Language:JavaScript 5.4%Language:CSS 4.8%