Skip to content

Instantly share code, notes, and snippets.

@sn3p
Created July 2, 2015 10:12
Show Gist options
  • Save sn3p/35247b74c2d403272caa to your computer and use it in GitHub Desktop.
Save sn3p/35247b74c2d403272caa to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
// ----
// Sass (v3.4.14)
// Compass (v1.0.3)
// ----
%file-links {
%style {
&::before {
background: no-repeat center;
content: "";
display: inline-block;
height: 24px;
margin-right: 4px;
vertical-align: top;
width: 16px;
}
* {
font-size: inherit;
font-style: inherit;
font-weight: inherit;
}
}
$files: (
"pdf.png": ("pdf"),
"word.png": ("doc"),
"excel.png": ("xls", "csv"),
"powerpoint.png": ("ppt"),
"text.png": ("rtf", "txt"),
"video.png": ("mov", "mpeg", "avi", "mkv", "mp4", "qt", "3gp", "flv", "wmv"),
"audio.png": ("mp3", "wav", "aif", "m4a", "ogg", "flac"),
"archive.png": ("zip", "rar", "7z", "tar"),
"photoshop.png": ("psd", "psb")
);
@each $icon, $extentions in $files {
@each $extention in $extentions {
a[href*=".#{$extention}"] {
@extend %style;
&::before {
// background-image: url(image-path('file-types/#{$icon}'));
background-image: url('http://defacto.learningspaces.dev/assets/file-types/#{$icon}');
}
}
}
}
}
article {
@extend %file-links;
}
article a[href*=".pdf"]::before, article a[href*=".doc"]::before, article a[href*=".xls"]::before, article a[href*=".csv"]::before, article a[href*=".ppt"]::before, article a[href*=".rtf"]::before, article a[href*=".txt"]::before, article a[href*=".mov"]::before, article a[href*=".mpeg"]::before, article a[href*=".avi"]::before, article a[href*=".mkv"]::before, article a[href*=".mp4"]::before, article a[href*=".qt"]::before, article a[href*=".3gp"]::before, article a[href*=".flv"]::before, article a[href*=".wmv"]::before, article a[href*=".mp3"]::before, article a[href*=".wav"]::before, article a[href*=".aif"]::before, article a[href*=".m4a"]::before, article a[href*=".ogg"]::before, article a[href*=".flac"]::before, article a[href*=".zip"]::before, article a[href*=".rar"]::before, article a[href*=".7z"]::before, article a[href*=".tar"]::before, article a[href*=".psd"]::before, article a[href*=".psb"]::before {
background: no-repeat center;
content: "";
display: inline-block;
height: 24px;
margin-right: 4px;
vertical-align: top;
width: 16px;
}
article a[href*=".pdf"] *, article a[href*=".doc"] *, article a[href*=".xls"] *, article a[href*=".csv"] *, article a[href*=".ppt"] *, article a[href*=".rtf"] *, article a[href*=".txt"] *, article a[href*=".mov"] *, article a[href*=".mpeg"] *, article a[href*=".avi"] *, article a[href*=".mkv"] *, article a[href*=".mp4"] *, article a[href*=".qt"] *, article a[href*=".3gp"] *, article a[href*=".flv"] *, article a[href*=".wmv"] *, article a[href*=".mp3"] *, article a[href*=".wav"] *, article a[href*=".aif"] *, article a[href*=".m4a"] *, article a[href*=".ogg"] *, article a[href*=".flac"] *, article a[href*=".zip"] *, article a[href*=".rar"] *, article a[href*=".7z"] *, article a[href*=".tar"] *, article a[href*=".psd"] *, article a[href*=".psb"] * {
font-size: inherit;
font-style: inherit;
font-weight: inherit;
}
article a[href*=".pdf"]::before {
background-image: url("http://defacto.learningspaces.dev/assets/file-types/pdf.png");
}
article a[href*=".doc"]::before {
background-image: url("http://defacto.learningspaces.dev/assets/file-types/word.png");
}
article a[href*=".xls"]::before {
background-image: url("http://defacto.learningspaces.dev/assets/file-types/excel.png");
}
article a[href*=".csv"]::before {
background-image: url("http://defacto.learningspaces.dev/assets/file-types/excel.png");
}
article a[href*=".ppt"]::before {
background-image: url("http://defacto.learningspaces.dev/assets/file-types/powerpoint.png");
}
article a[href*=".rtf"]::before {
background-image: url("http://defacto.learningspaces.dev/assets/file-types/text.png");
}
article a[href*=".txt"]::before {
background-image: url("http://defacto.learningspaces.dev/assets/file-types/text.png");
}
article a[href*=".mov"]::before {
background-image: url("http://defacto.learningspaces.dev/assets/file-types/video.png");
}
article a[href*=".mpeg"]::before {
background-image: url("http://defacto.learningspaces.dev/assets/file-types/video.png");
}
article a[href*=".avi"]::before {
background-image: url("http://defacto.learningspaces.dev/assets/file-types/video.png");
}
article a[href*=".mkv"]::before {
background-image: url("http://defacto.learningspaces.dev/assets/file-types/video.png");
}
article a[href*=".mp4"]::before {
background-image: url("http://defacto.learningspaces.dev/assets/file-types/video.png");
}
article a[href*=".qt"]::before {
background-image: url("http://defacto.learningspaces.dev/assets/file-types/video.png");
}
article a[href*=".3gp"]::before {
background-image: url("http://defacto.learningspaces.dev/assets/file-types/video.png");
}
article a[href*=".flv"]::before {
background-image: url("http://defacto.learningspaces.dev/assets/file-types/video.png");
}
article a[href*=".wmv"]::before {
background-image: url("http://defacto.learningspaces.dev/assets/file-types/video.png");
}
article a[href*=".mp3"]::before {
background-image: url("http://defacto.learningspaces.dev/assets/file-types/audio.png");
}
article a[href*=".wav"]::before {
background-image: url("http://defacto.learningspaces.dev/assets/file-types/audio.png");
}
article a[href*=".aif"]::before {
background-image: url("http://defacto.learningspaces.dev/assets/file-types/audio.png");
}
article a[href*=".m4a"]::before {
background-image: url("http://defacto.learningspaces.dev/assets/file-types/audio.png");
}
article a[href*=".ogg"]::before {
background-image: url("http://defacto.learningspaces.dev/assets/file-types/audio.png");
}
article a[href*=".flac"]::before {
background-image: url("http://defacto.learningspaces.dev/assets/file-types/audio.png");
}
article a[href*=".zip"]::before {
background-image: url("http://defacto.learningspaces.dev/assets/file-types/archive.png");
}
article a[href*=".rar"]::before {
background-image: url("http://defacto.learningspaces.dev/assets/file-types/archive.png");
}
article a[href*=".7z"]::before {
background-image: url("http://defacto.learningspaces.dev/assets/file-types/archive.png");
}
article a[href*=".tar"]::before {
background-image: url("http://defacto.learningspaces.dev/assets/file-types/archive.png");
}
article a[href*=".psd"]::before {
background-image: url("http://defacto.learningspaces.dev/assets/file-types/photoshop.png");
}
article a[href*=".psb"]::before {
background-image: url("http://defacto.learningspaces.dev/assets/file-types/photoshop.png");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment