Gathering detailed insights and metrics for ember-css-modules-active-route
Gathering detailed insights and metrics for ember-css-modules-active-route
Gathering detailed insights and metrics for ember-css-modules-active-route
Gathering detailed insights and metrics for ember-css-modules-active-route
`:app-root` & `:document-root` selectors to apply styles to the root element, when a route is active.
npm install ember-css-modules-active-route
Typescript
Module System
Min. Node Version
TypeScript (57.26%)
JavaScript (30.76%)
HTML (10.19%)
CSS (1.78%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
NOASSERTION License
9 Stars
143 Commits
2 Watchers
25 Branches
2 Contributors
Updated on Jul 01, 2025
Latest Version
0.4.2
Package Id
ember-css-modules-active-route@0.4.2
Unpacked Size
25.95 kB
Size
8.63 kB
File Count
39
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
36
:app-root
and :document-root
selectors to apply styles to the root element,
when a route is active.
ember install ember-css-modules-active-route ember-css-modules
This is a plugin for ember-css-modules
, so you need to
have it installed as well.
:app-root
: Maps to the root element of your application.
Usually <body>
.:document-root
: Maps to the documentElement
/
:root
, which is the <html>
element.1Router.map(function() { 2 this.route('foo', function() { 3 this.route('bar'); 4 }); 5 this.route('qux'); 6});
1/* app/foo/styles.css */ 2 3:app-root { 4 background: green; 5}
1/* app/foo/index/styles.css */ 2 3:app-root { 4 background: red; 5}
When the user enters the foo
route, the :app-root
pseudo-selector will be
applied to the app's rootElement
(<body>
). The background of the page will
be red
, as foo.index
overrides foo
.
When the user navigates to foo.bar
, the background will turn green
, as the
user has left the foo.index
route and the override no longer takes effect.
When the user navigates to qux
, the background will become transparent again,
as no route styles are active any more.
You can also combine the :app-root
& :document-root
selectors with other
regular selectors. For instance, instead of just using :document-root
, which
targets the :root
element (<html>
), you can target child elements instead:
1:document-root :global(.some-cookie-banner) { 2 display: none; 3}
In this example, <div class="some-cookie-banner">
is inserted by the backend
and would be hidden, while the user is on a certain route.
CSS Specificity can be a tricky thing. This addon tries to make everything work out of the box. For every level of nesting, the selector specificity will be increased automatically. This way, overrides in child routes actually override declarations in parent routes, without the source order being relevant.
You can also manually set the specificity, like so:
1:app-root(3) { 2 background: red; 3} 4 5:app-root(2) { 6 background: green; 7}
The background will be red
, as 3
is a higher specificity than 2
.
The :app-root
/ :app-root(n)
and :document-root
/ :document-root(n)
selectors are replaced with "magic" class name selectors by
lib/route-plugin.js
. These selectors are repeated n
times to raise them to the necessary specificity level.
n
can either be specified explicitly as :app-root(n)
, or when used as
:app-root
will be derived from the depth of route nesting by counting the /
in the file path of the respective styles.css
. This ensures that rules in
nested child routes override rules from their parent routes.
1:app-root { 2 background: yellow; 3} 4:app-root(3) { 5 background: green; 6} 7:app-document(1) body { 8 background: blue; 9} 10 11/* becomes */ 12 13/* Class name may be repeated more often depending on level of nesting. */ 14.css-modules-active-route-app.css-modules-active-route-app { 15 background: yellow; 16} 17 18/* With an explicit `n` provided, the class name is repeated that many times. */ 19.css-modules-active-route-app.css-modules-active-route-app.css-modules-active-route-app { 20 background: green; 21} 22 23/* Combining with other selectors is possible. */ 24.css-modules-active-route-document body { 25 background: blue; 26}
When the a transition is started or finished the
CSSModulesActiveRouteService
resolves the styles for the current route hierarchy via the Ember container
using the route name. This implies, that you cannot render custom / non-default
templates for routes,
which is deprecated anyway.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
83 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More