Cannot include mixin in v4

Hi,
I am running Ionic v4 Alpha 7 and when i try to use mixing i.e @include rotate(180deg) it gives error:
No mixin named rotate

1 Like

Hey @dotnetdreamer. Can you please tell me what do you exactly want to do to an object? Do you just want to rotate an element to 180 degrees?

hi @umerf6455, no i need to have access to mixins. I can rotate element via css but i need to access mixins like this @include rotate() or @include ltr() etc…which is working in v3

Sorry bro. I’ve also worked with mixins in v3 and they work fine there. Have no idea of v4. Sorry.

No worries still thankful for your time. Its weired though…i can see those mixins in @ionic folder inside node_modules…

Hope you get help brother :confused:

1 Like

For those who needs to do the same thing, i added the themes folder in angular cli as explain here. I added the files like so:

...
"styles": [
...
],
"stylePreprocessorOptions": {
"includePaths": [
     "node_modules/@ionic/angular/dist/themes"
]
}
...

then i imported the mixins file like so:

@import "ionic.mixins";
//here it works now
.test {
    @include ltr() {
        text-align: left;
    }
}
1 Like

Hello, did someone else solve this? I have the same problem :frowning:

In Ionic 4.11.0, I added "stylePreprocessorOptions" in my angular.json to get the transform mixin working:

            "stylePreprocessorOptions": {
              "includePaths": [
                "node_modules/@ionic/core/dist/collection/themes"
              ]
            },
            "styles": [
              {
                "input": "src/theme/variables.scss"
              },
              {
                "input": "src/global.scss"
              }
            ],

Then in global.scss, I added:

@import "ionic.mixins";
1 Like

After I add stylePreprocessorOptions. It gives me this error:

[ng] Module build failed (from ./node_modules/sass-loader/lib/loader.js):
[ng] @at-root #{add-root-selector($root, “[dir=rtl]”)} {
[ng] ^
[ng] Invalid CSS after “…tor(.pull-left,”: expected selector, was ‘"[dir=rtl]")’
[ng] in /Users/saoud/ionic4/node_modules/@ionic/core/dist/collection/themes/ionic.mixins.scss (line 162, column 41)

1 Like

I get this error too. Did you find a solution for this error?