Sha256: b23049edd4bbdd41627b83f8261469f294a588010f1e519b8b4b728a21b67777
Contents?: true
Size: 975 Bytes
Versions: 1
Compression:
Stored size: 975 Bytes
Contents
// Usage: // // - Call with a module name + selector name to get a transformed (opaque) selector // // ```js // CSSModule("events_index", "header") // // => "..." (some opaque string that matches the stylesheet) // ``` // // - Call with a module name to get a function for modulizing selectors // // ```js // var eventsModule = CSSModule("events_index") // var headerSelector = eventsModule("header") // var footerSelector = eventsModule("footer") // ``` // // This behavior has to match `CSSModules::Rewrite` in Ruby // so that generated selectors match. function CSSModule(moduleName, selectorName) { // This matches `Rewrite`: var opaqueString = btoa(moduleName).replace(/[^a-zA-Z0-9]/g, "") var transformedModuleName = opaqueString + "_" + moduleName; if (selectorName) { return transformedModuleName + "_" + selectorName; } else { return function(selectorName) { return transformedModuleName + "_" + selectorName; }; } };
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
css_modules-0.1.0 | lib/css_modules/assets/css_module.js |