diff --git a/lib/css.js b/lib/css.js index 0d2166d..28d606f 100644 --- a/lib/css.js +++ b/lib/css.js @@ -56,7 +56,7 @@ function getImports(root, css) { if (position !== -1) { inliner.jobs.add('link', 1); - var match = (css.match(/@import\s*(.*?);/) || [null, ''])[1]; + var match = (css.match(/@import(\s*.*?);/) || [null, ''])[1]; var url = match.replace(/url/, '') .replace(/['}"()]/g, '') .replace(/;/, '') @@ -74,7 +74,7 @@ function getImports(root, css) { importedCSS = '@media ' + url.join(' ') + '{' + importedCSS + '}'; } - css = css.replace('@import ' + match, importedCSS); + css = css.replace('@import' + match, importedCSS); return getImports.call(inliner, root, css); }); } diff --git a/test/fixtures/css-import.result.html b/test/fixtures/css-import.result.html index 2f46cd2..7831350 100644 --- a/test/fixtures/css-import.result.html +++ b/test/fixtures/css-import.result.html @@ -1 +1 @@ - inline style + inline style diff --git a/test/fixtures/css-import.src.html b/test/fixtures/css-import.src.html index 44eab2b..6459e28 100644 --- a/test/fixtures/css-import.src.html +++ b/test/fixtures/css-import.src.html @@ -12,6 +12,8 @@ @import 'import.css'; /* four */ @import url('import.css') screen and (orientation:landscape); + /* five */ + @import"import.css";