Skip to content

Instantly share code, notes, and snippets.

@f
Created May 28, 2016 12:41
Show Gist options
  • Select an option

  • Save f/4cc28146971251547e5e786d29ca3607 to your computer and use it in GitHub Desktop.

Select an option

Save f/4cc28146971251547e5e786d29ca3607 to your computer and use it in GitHub Desktop.
(function ($) {
$.module = function (module, selector) {
var name = btoa(module).replace(/\W|\=/g,"")
var el = selector.split(/\s+/).map(function (sub_selector) {
return sub_selector.replace(/^([\.#])(.*)/g, function (_, f, s) {
return f + name + "_" + s
})
}).join(" ")
return $(el)
}
})(jQuery)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment