Ionic- angular components.core.scss error

Only starting with Ionic 2. My first application crashes with an error:

Error: import directives cannot be used in directives or mixes. on line 34 from node_modules / ionic- angular / components.core.scss @import "fonts / ionics";

Has anyone encountered this problem and know how to solve it? I would be very grateful for your help!

+5
source share
4 answers

I found a solution for this: Updated one of the dependencies (one of which is related to sass). To fix this problem without changing the files in node-modules, you need to use specific versions for gulp-sass and node-sass. Use the following commands:

npm install gulp-sass@2.2.0 npm install node-sass@3.4.2 
+6
source

In the current beta ( v2.0.0-beta.5 ) in conjunction with Sass Sass 3.4.13 , there seems to be a bug with @import inside @if . This is not allowed.

Comment on the @if structure in node_modules/iconic_angular/components.core.scss to look like this:

 $ionicons: true !default; // @if ($ionicons) { @import "fonts/ionicons"; // } 

In addition, there is a problem with some declarations in the Sass file for Windows. If you don't need Windows, now you can change the sass include defintion in node_modules/ionic-gulp-sass-build/index.js to read (so remove the include for windows).

 ... src: 'app/theme/app.+(ios|md).scss', ... 
+4
source

This bug is fixed in the ionic version "2.0.0-beta.6". You can update or check this commit to fix saas errors

+1
source

Go to node_modules/ionic-angular/components.core.scss and set the variable ( $ionicons ) to false .

-1
source

Source: https://habr.com/ru/post/1247568/


All Articles