Skip to content

Commit e66d6e7

Browse files
committed
fix: update type declarations, allow context to be undefined
This updates the type declarations to be in sync with @stencil/core. This also allows context to be undefined, which allows importing 3rd party styles. Fixes #15
1 parent 4b6524d commit e66d6e7

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export function postcss(opts: d.PluginOptions = {}): d.Plugin {
1414
return null;
1515
}
1616

17-
if (!context || !util.usePlugin(fileName)) {
17+
if (!util.usePlugin(fileName)) {
1818
return null;
1919
}
2020

src/util.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ export function getRenderOptions(opts: d.PluginOptions, sourceText: string, cont
1616

1717
const injectGlobalPaths = Array.isArray(opts.injectGlobalPaths) ? opts.injectGlobalPaths.slice() : [];
1818

19-
if (injectGlobalPaths.length > 0) {
19+
if (context && injectGlobalPaths.length > 0) {
2020
// automatically inject each of these paths into the source text
2121
const injectText = injectGlobalPaths.map(injectGlobalPath => {
22-
if (!path.isAbsolute(injectGlobalPath)) {
22+
if (!path.isAbsolute(injectGlobalPath) && context.config.rootDir) {
2323
// convert any relative paths to absolute paths relative to the project root
2424
injectGlobalPath = path.join(context.config.rootDir, injectGlobalPath);
2525
}

0 commit comments

Comments
 (0)