sass -t expanded styles.scss:styles.css
Last active
August 5, 2019 02:52
-
-
Save juque/d2704de88e831277e16dd76722eb7c3d to your computer and use it in GitHub Desktop.
emmet lib
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .sass-cache | |
| *css.map |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Read a HTML file and spit its CSS skeletor | |
| from bs4 import BeautifulSoup | |
| def make_rule(name,type=0): | |
| id_or_class = ['.','#'] | |
| variable = """ | |
| {}{} {{ | |
| }} | |
| """.format(id_or_class[type],name) | |
| return variable | |
| file = open('t.html') | |
| content = file.read() | |
| soup = BeautifulSoup(content,'html.parser') | |
| classes = [] | |
| ids = [] | |
| for ele in soup.find_all(class_=True): | |
| classes.extend(ele['class']) | |
| for ele in soup.find_all(True,{'id':True}): | |
| ids.append(ele.get('id')) | |
| # classes | |
| unique = [] | |
| [unique.append(item) for item in classes if item not in unique] | |
| # main | |
| for id in ids: | |
| print(make_rule(id,1)) | |
| for cl in unique: | |
| print(make_rule(cl)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| nav.nav>ul.nav__menu>li.nav__item*5>a[href="#"].nav__link{item} | |
| <nav class="nav"> | |
| <ul class="nav__menu"> | |
| <li class="nav__item"><a class="nav__link" href="#">item</a></li> | |
| <li class="nav__item"><a class="nav__link" href="#">item</a></li> | |
| <li class="nav__item"><a class="nav__link" href="#">item</a></li> | |
| <li class="nav__item"><a class="nav__link" href="#">item</a></li> | |
| <li class="nav__item"><a class="nav__link" href="#">item</a></li> | |
| </ul> | |
| </nav> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .nav__menu { | |
| list-style: none; | |
| margin: 0; | |
| padding: 0; | |
| } | |
| .nav__item { | |
| border: 1px solid red; | |
| } | |
| .nav__link { | |
| color: red; | |
| display: block; | |
| } | |
| /*# sourceMappingURL=styles.css.map */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .nav { | |
| &__menu { | |
| list-style: none; | |
| margin: 0; | |
| padding: 0; | |
| } | |
| &__item { | |
| border:1px solid red; | |
| } | |
| &__link { | |
| color: red; | |
| display: block; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment