Skip to content

Instantly share code, notes, and snippets.

@mamboer
Created May 31, 2013 08:47
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mamboer/5683672 to your computer and use it in GitHub Desktop.
Save mamboer/5683672 to your computer and use it in GitHub Desktop.
A regex pattern for matching css's inline import url.
//Paste the code below into chrome's console and press enter!
//Thanks to @alextang https://github.com/ikitty
var css = "@import url('file1.css');\r\n"+
"@import url('file2.css');\r\n"+
".test3{\r\n"+
" height: 1px;\r\n"+
"}";
var regexTpl = /@import url\(([^)]*)\);?/gi,match;
while((match=regexTpl.exec(css))){
console.log(match);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment