-
Notifications
You must be signed in to change notification settings - Fork 147
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
Importing SCSS files from node_modules
#44
Comments
Your What kind of problem are you having? Can you make a reproduction of it? I've just tried this: <style type="text/scss">
@import '@material/button/mdc-button';
.mdc-button {
@include mdc-button-filled-accessible(green);
}
</style> And the mixins seems to be working |
I'm trying to enable the ripple effect, and it's not working when I import the Sass files this way. Here's my entire component code: <script>
import { onMount, onDestroy } from 'svelte';
import { MDCRipple } from '@material/ripple';
import MatIcon from './MatIcon.svelte';
let disabled = null;
export { disabled };
export let flat = null;
export let raised = null;
export let outlined = null;
export let dense = null;
export let icon = null;
export let trailing = null;
let buttonRipple = null;
onMount(() => {
buttonRipple = new MDCRipple(document.querySelector('.mdc-button'));
});
onDestroy(() => {
if (buttonRipple) {
buttonRipple.destroy();
}
});
</script>
<style type="text/scss">
@import '@material/button/mdc-button';
</style>
<button
class="mdc-button"
class:mdc-button--raised={raised && !flat && !outlined}
class:mdc-button--unelevated={flat && !raised && !outlined}
class:mdc-button--outlined={outlined && !flat && !raised}
class:mdc-button--dense={dense}
on:click
on:dblclick
disabled={disabled && disabled !== 'false'}>
{#if icon && !trailing}
<MatIcon button> {icon} </MatIcon>
{/if}
<span class="mdc-button__label">
<slot />
</span>
{#if icon && trailing}
<MatIcon button> {icon} </MatIcon>
{/if}
</button> The event listener adds CSS classes to the button on click, but they're not recognized by the browser... |
Ooooh, I see what's happening. Svelte removes unused classes from your template, so all those A suggestion I can make to you is to add a obs: To use the |
@kaisermann I've managed to solve the problem by configuring the sass compiler: preprocess: autoPreprocess({
scss: { includePaths: ['src', 'node_modules'] },
}), Any idea what's happening? |
I'm also trying to use material via scss but get this error: Cannot find module './transformers/text/scss.js'
source here
|
@quantuminformation the culprit is your |
@kaisermann please can you share a working rollup config for sapper with working material.ui imports. I have |
@LucianVoju Here's a working example: |
@YogliB thank you |
Have you managed to have the ripple effect? |
Link is broken |
@sidharthramesh |
@YogliB seems like your repo is gone |
still not work for customElement. |
How do I do that correctly?
I tried:
But not all mixins are being imported from inside the file...
The text was updated successfully, but these errors were encountered: