Skip to content

Instantly share code, notes, and snippets.

@tjhanley
Last active August 29, 2015 14:02
Show Gist options
  • Save tjhanley/8d8b182ce1bb7845631c to your computer and use it in GitHub Desktop.
Save tjhanley/8d8b182ce1bb7845631c to your computer and use it in GitHub Desktop.
Interchange no longer working. Foundation actually dies compeletly.
<img data-interchange="[//bevel-assets.s3.amazonaws.com/checkout/order-products.png,(default)], [//bevel-assets.s3.amazonaws.com/checkout/[email protected], (retina)]" src="" width="100%">
$> cat Gemfile.lock|grep foundation
remote: git://github.com/alexkrus/foundation-icons-sass-rails
foundation-icons-sass-rails (3.0.0)
foundation-rails (5.2.3.0)
foundation-icons-sass-rails!
foundation-rails
 x = '//bevel-assets.s3.amazonaws.com/proof/before-after-1.png,(default)'
 y = '//bevel-assets.s3.amazonaws.com/pro,of/before,-after-1.png,(default)'
 
/**
Pattern: /(^.+\.[aA-zZ]{1,4}\,\((.+)\)/
should match path + extensions (gif,jpg,jpeg,png,svg,etc.)
*/

 //instead of regex split using group matching
 x.match(/(^.+\.[aA-zZ]{1,4}\,\((.+)\)/)
 /**
 [ '//bevel-assets.s3.amazonaws.com/proof/before-after-1.png,(default)',
  '//bevel-assets.s3.amazonaws.com/proof/before-after-1.png',
  'default',
  index: 0,
  input: '//bevel-assets.s3.amazonaws.com/proof/before-after-1.png,(default)' ]
 */
 
 y.match(/(^.+\.[aA-zZ]{1,4}\,\((.+)\)/)
 /**
 [ '//bevel-assets.s3.amazonaws.com/pro,of/before,-after-1.png,(default)',
  '//bevel-assets.s3.amazonaws.com/pro,of/before,-after-1.png',
  'default',
  index: 0,
  input: '//bevel-assets.s3.amazonaws.com/pro,of/before,-after-1.png,(default)' ]
 */
 
@lozandier
Copy link

Hi, @tjhandley

Is this specific towards handling situations where you don't have a protocol, or something else?

Do you recommend this solution to be included part of parse_data_attr or somewhere else?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment