Render SVG HAML template with Rails Asset Pipeline -


I have a SVG to keep the syntax that I have created using the Haml to clean. I can use the image as a background image in fine CSS using a railroad route, but I really want to serve svg.haml precompile in a svg and it stabilizes.

There is a way to add a templated SVG to the property pipeline and in such a way that SVG can be digested like the rest of my property together as a stable asset in the precompiled SCSS From it reference?

Text after "div class =" itemprop = "text">

Then, here is an example SVG (seal.svg.haml) in apps / assets / images :

  points = 60; Interval = 360.0 / digit% svg {xmlns: 'http://www.w3.org/2000/svg', 'xmlns: xlink' = & gt; 'Http://www.w3.org/1999/xlink', 'xmlns: svg' = & gt; 'Http://www.w3.org/2000/svg', viewBox: '0 200 200'}% defs% polygon # point {points: '100,0 104,8 96,8'}% g {fill} : '# 333'}% {cycle cx: 100, cy: 100, r: 88, stroke: '# 333', 'stroke-width' => 2, Fill: 'Transparent'} - Points. Do notes. Point | % Use {'xlink: href' = & gt; '# Dot', 'transform' = & gt; "Again, I register the haml engine for the pipeline of assets with config / initializers / haml_assets.rb:   

Rail Application Assets.Register_agine '.html', Tilt :: HimalTemplate

Then, it works fine:

 . {Background: Transparent url (asset_path ('seal.svg')) No-double center top;}  

Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -