css - Background image doesn't work after assets precompile in RAILS4 production environment -
i have following mixin in application.css.scss file :
@mixin inputwithicon($iconname) { padding: 4px 4px 4px 20px; border:1px solid #ccc; text-indent: 0.30em; font-size:15px; font-weight:100; background: #ffffff url(assets/input/#{$iconname}.png) no-repeat; background-position: 2% center; } this mixin works on development after precompiling assets , running in production stops working (background isn't set).
i tried using image-url instead of url, didn't work.
background: #ffffff asset-url("assets/input/#{$iconname}.png") no-repeat; --
in sass, use asset-url; scss asset_url.
either way, need use above helper when assets fingerprinted through precompilation, correct file being referenced pre-processor.
the problem have url calls static filename. whilst not problem on own, when deploy app, , precompilation occurs, need make sure css referencing correct filename, hence helper.
Comments
Post a Comment