Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lightning CSS can’t be configured to use a different includes folder #523

Closed
paulrobertlloyd opened this issue Dec 9, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@paulrobertlloyd
Copy link
Contributor

paulrobertlloyd commented Dec 9, 2023

Version

2.0.0

Platform

Deno 1.38.5

What steps will reproduce the bug?

Lume options:

const site = lume({
  src: "./src",
  includes: "_layouts",
});

LigntingCSS options:

site.use(lightningCss({
  includes: "_styles",
  drafts: {
    customMedia: true,
    nesting: true,
  },
}));

CSS file:

src/app.css trying to import from src/_styles/config/_custom-properties.css:

@import url("config/_custom-properties.css");

What is the expected behavior?

CSS file gets bundled.

What do you see instead?

Results in the following error:

Error: No result
    at napi_create_error (file:///Users/paulrobertlloyd/Library/Caches/deno/npm/registry.npmjs.org/napi-wasm/1.0.1/index.mjs:866:15)
    at <anonymous> (wasm://wasm/02a4df8e:1:7124758)
    at <anonymous> (wasm://wasm/02a4df8e:1:7118080)
    at <anonymous> (wasm://wasm/02a4df8e:1:7110732)
    at Object.bundle (file:///Users/paulrobertlloyd/Library/Caches/deno/npm/registry.npmjs.org/napi-wasm/1.0.1/index.mjs:248:19)
    at bundleAsync (file:///Users/paulrobertlloyd/Library/Caches/deno/npm/registry.npmjs.org/lightningcss-wasm/1.22.1/async.mjs:68:21)
    at async lightningCSSBundler (https://deno.land/x/lume@v2.0.0/plugins/lightningcss.ts:143:24)
    at async Processors.run (https://deno.land/x/lume@v2.0.0/core/processors.ts:31:7)
    at async Site.#buildPages (https://deno.land/x/lume@v2.0.0/core/site.ts:638:5)
    at async Site.build (https://deno.land/x/lume@v2.0.0/core/site.ts:506:9) {
  code: "GenericFailure",
  fileName: "/Users/paulrobertlloyd/Sites/paulrobertlloyd-v5/src/app.css",
  loc: { line: 2, column: 1 },
  data: "ResolverError"
}

Additional information

Moving config/_custom-properties.css to src/_layouts folder (which is set as site.options.includes), the error disappears.

From a quick glance, it looks the includes option gets overridden by site.options.includes here, and perhaps userOptions isn’t taken? https://deno.land/x/lume@v2.0.0/plugins/lightningcss.ts?source#L57

@paulrobertlloyd paulrobertlloyd added the bug Something isn't working label Dec 9, 2023
@oscarotero
Copy link
Member

Hi. Thanks for this. It's indeed a bug here: https://deno.land/x/lume@v2.0.0/plugins/lightningcss.ts?source#L112
The plugin is getting the includes value from site.options instead of the plugin options.
I'll fix it.

@oscarotero
Copy link
Member

Fixed in Lume v2.0.1

@paulrobertlloyd
Copy link
Contributor Author

Brill, thanks for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants