Skip to content

Commit

Permalink
fix(build/css): properly handle css linked in index.html for build
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jul 2, 2020
1 parent b6e91e0 commit 1fa4d9a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/node/build/buildPluginHtml.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Plugin, RollupOutput, OutputChunk } from 'rollup'
import path from 'path'
import fs from 'fs-extra'
import { isExternalUrl, cleanUrl, isStaticAsset } from '../utils/pathUtils'
import { isExternalUrl, cleanUrl } from '../utils/pathUtils'
import { resolveAsset } from './buildPluginAsset'
import {
parse as Parse,
Expand Down Expand Up @@ -182,8 +182,10 @@ const compileHtml = async (
!isExternalUrl(p.value.content)
) {
const url = cleanUrl(p.value.content)
js += `\nimport ${JSON.stringify(url)}`
if (isStaticAsset(url)) {
if (url.endsWith('.css')) {
js += `\nimport ${JSON.stringify(url)}`
s.remove(node.loc.start.offset, node.loc.end.offset)
} else {
assetUrls.push(p)
}
}
Expand Down

0 comments on commit 1fa4d9a

Please sign in to comment.