asset pipeline - Dynamic (S)CSS in rails 3.1 -


i'm trying allow user customize application using yml files.
when user updates things css needs updated well.

i'd solve problem using dynamic css instead. way planning on doing have settings scss file other css files import , use.

here have far:

settings.scss.erb:

$width: <%= rails.application.config.width %>px; 

main.css.scss:

//= require settings  @import "settings";  #main {   width: $width; } 

but error:

invalid css after "$width: ": expected expression (e.g. 1px, bold), "<%= rails.appli..."` 

so seems settings not being passed through erb parser before being handed off scss parser, there way solve this.

i'd rather not put in .erb files since text editor doesn't support (syntax highlighting , commands) when having scss in erb files

side stepping problem erb not being parsed, not going able customize css dynamically (i think main file may require erb extension). asset pipeline designed serve assets in way tells browsers static , not going change.

assuming erb parsing working, width rendered during precompile phase, or on first request. if using sprockets far-future headers set tell remote clients cache content 1 year. , sprockets picks changes if timestamp of file changes, never new values.

you force sprockets dynamically serve every request, , not send headers, not designed , there significant performance risks in doing so.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -