Skip to content

Script to nest all rules of a CSS document inside an arbitrary selector

License

Notifications You must be signed in to change notification settings

adrienverge/nest-css

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

nest-css

Script to nest all rules of a CSS document inside an arbitrary selector.

Example

Running:

./nest-css.py original.css '#container' > modified.css

on original.css:

@namespace "http://www.w3.org/1999/xhtml";

/* children of the <head> element all have display:none */
head, link, meta,
script, style, title {
    display: none;
}

body {
    display: block;
    margin: 8px;
}

input, input:matches([type="password"], [type="search"]) {
    border-radius: 5px;
    border: 1px solid #4c4c4c;
    cursor: auto;
}

would give modified.css:

@namespace "http://www.w3.org/1999/xhtml";

/* children of the <head> element all have display:none */
#container head, #container  link, #container  meta,
#container  script, #container  style, #container  title {
    display: none;
}

#container body {
    display: block;
    margin: 8px;
}

#container input, #container input:matches([type="password"], [type="search"]) {
    border-radius: 5px;
    border: 1px solid #4c4c4c;
    cursor: auto;
}

About

Script to nest all rules of a CSS document inside an arbitrary selector

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages