Wednesday, 15 February 2012

ruby - AWS to serve CSS images Sinatra -


I am using the asset_sync gem to sync my assets in S3 bucket. I want to use and use my local files in development. So I have set up the following with a helper:

Configure the environment / development.rb

 : The development is set: asset_host, "/" end  < / Pre> 

Environment / Production .rb

  Configure: The output is set: asset_host, "https://s3-eu-west-1.amazonaws.com/# {ENV [FOG_DIRECTORY ']} "End << / code>  

ASSISTANT

  Aadhaar DAF can file aws_asset (path) .Join settings.set_host, path expiration < / Code>  

So in my thoughts I can do this

    

As a result, it will result in the development of my local assets or when I am in production with my bucket

What if I want to render an image from inside My main cas file, such as background image? I can not do this for example because it is not an ARB file

main.css

  header {background: #ffffff url (';) Repeat-X; }   

So what can I do?

Thanks for any help from 3 ways

Precompile Assets

Before deploying, precompile assets and css if you create a file called main.css.erb and then If you run to create main.css through the ERB, then it will have the right content. It will be my priority. Precompile has many ways, I like but YMMV


Edit:

  Guard 'lift and twist from erb',: input = & gt; 'App / Scene / Stylesheet / Main Cass. ARB ',: Output = & gt;   

Something like this "Public / property / stylesheet / main case" clock (% r {app / views / stylesheets / main.css.erb})


Create a route while compiling that property

This is similar to the way you use the SASS template with Sinatra (if you do not precompile them) just do it as above, set a path for main.css Run and run the main.css.erb template through ERB. Add a lot.


Edit:

 Get code for "/assets/stylesheets/main.css" #caching Remember: erg "stylesheet / main. Css "end   

I started writing and I can not remember 3. In my defense, I have a terrible headache, maybe someone else will remember me for me.

No comments:

Post a Comment