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

Support of scss/less @import / @use within the <style> section of vue components #4177

Closed
simontaurus opened this issue Jan 6, 2025 · 1 comment

Comments

@simontaurus
Copy link

Description

I've played around with scss/less @import / @use within the <style> section of vue components (see also #4164)

<style lang="scss" >
@use 'https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css';
</style>

Option 2:

<style lang="less">
@import url('https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css');
</style>

I would expect that the referenced css file is included in the app.
Instead it seems like both variants do not have any effect (bootstrap.min.css not loaded) while a build of the component with vite works as expected.

Is this setup not supported by nicegui or is there an issue with my specific stack (Win11, Python 3.11.9, pypyscss / lesscpy installed)

PS: As a workaround I use ui.add_head_html()

@falkoschindler
Copy link
Contributor

Hi @simontaurus,

I'm not too familiar with SCSS and LESS, but according to claude.ai these code snippets are not supported in Vue single file components (SFC):

The @use rule in SCSS cannot load external URLs directly. It's designed to work with local files and modules.

While LESS does support @import url(), using it within Vue's single file components to import external stylesheets isn't recommended and may not work as expected.

So I'd suggest to verify the syntax with a plain Vue app. If it does work, we should look into vbuild which is used by NiceGUI to process SFCs.

@falkoschindler falkoschindler closed this as not planned Won't fix, can't repro, duplicate, stale Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants