Skip to content

Commit

Permalink
fix(v2): ignore style imports in excerpt
Browse files Browse the repository at this point in the history
  • Loading branch information
lex111 committed Dec 21, 2020
1 parent b133e2d commit 7cefe40
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/docusaurus-utils/src/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ describe('load utils', () => {
input: `
import Component from '@site/src/components/Component';
import Component from '@site/src/components/Component'
import './styles.css';
export function ItemCol(props) { return <Item {...props} className={'col col--6 margin-bottom--lg'}/> }
Expand Down
2 changes: 1 addition & 1 deletion packages/docusaurus-utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ export function createExcerpt(fileString: string): string | undefined {
}

// Skip import/export declaration.
if (/^.*import\s.*from.*;?|export\s.*{.*};?/.test(fileLine)) {
if (/^\s*?import\s.*(from.*)?;?|export\s.*{.*};?/.test(fileLine)) {
continue;
}

Expand Down

0 comments on commit 7cefe40

Please sign in to comment.