Skip to content

~ tilde operator unable to path to scss beneath app/src #10077

Closed
@nhhockeyplayer

Description

@nhhockeyplayer

its documented that

~ is a quick way to reference root in order to operate paths to scss

https://scotch.io/tutorials/using-sass-with-the-angular-cli

"The tilde (~) will tell Sass to look in the src/ folder and is a quick shortcut to importing Sass files."

I am using latest releases and tilde is hardwired to node_modules dir

here is my source inside scss file

@font-face {
  font-family: "icon";
  src: url('~sass-chart-styles/fonts/icons/icon.eot?240c3b754b3c47134bf4a382f524781b?#iefix') format("embedded-opentype"),
url('~sass-chart-styles/fonts/icons/icon.woff2?240c3b754b3c47134bf4a382f524781b') format("woff2"),
url('~sass-chart-styles/fonts/icons/icon.woff?240c3b754b3c47134bf4a382f524781b') format("woff");
  font-weight: normal;
  font-style: normal;
}

here is output

ERROR in ./node_modules/raw-loader!./node_modules/postcss-loader/lib??embedded!./node_modules/sass-loader/lib/loader.js??ref--8-3!./src/sass/index.scss
(Emitted value instead of an instance of Error) CssSyntaxError: C:\apache-tomcat-9.0.0.M17\webapps\ROOT\api\src\sass\fonts\icons.scss:3:7: Can't resolve '.
./../node_modules/sass-chart-styles/fonts/icons/icon.eot' in 'C:\apache-tomcat-9.0.0.M17\webapps\ROOT\api\src\sass'

node_modules is clearly at the root of the tilde reference

why cant I path into my scss source code ?

Angular CLI: 1.7.3
Node: 9.3.0
OS: win32 x64
Angular: 5.2.9
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cdk: 5.2.4
@angular/cli: 1.7.3
@angular/flex-layout: 5.0.0-beta.13
@angular/material: 5.2.4
@angular-devkit/build-optimizer: 0.3.2
@angular-devkit/core: 0.3.2
@angular-devkit/schematics: 0.3.2
@ngtools/json-schema: 1.2.0
@ngtools/webpack: 1.10.2
@schematics/angular: 0.3.2
@schematics/package-update: 0.3.2
typescript: 2.6.2
webpack: 3.11.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions