如何在Angular8中使用样式预处理器

如何在Angular8中使用样式预处理器,angular,angular8,Angular,Angular8,我正在尝试学习如何在两个项目(project1、project2)中使用通用css和js。我在Google上搜索了angular.json中的StylePreprocessions,如下所示 "stylePreprocessorOptions": { "includePaths": [ "styles" ] }, 在图中,你可以找到我在项目文件夹外使用check.css的文件夹

我正在尝试学习如何在两个项目(project1、project2)中使用通用css和js。我在Google上搜索了angular.json中的StylePreprocessions,如下所示

    "stylePreprocessorOptions": {
      "includePaths": [
        "styles"
      ]
    },
在图中,你可以找到我在项目文件夹外使用check.css的文件夹

p{
  color:red
}

但是它不会影响我的p标签我是否遗漏了什么请告诉我如何在多个项目中使用常见的css和js文件。

希望这个答案对您有所帮助。
假设您有一个包含所有css代码的style.css,并且希望将其导入不同的组件以使用其代码

    lets say import "./../../code/styles.css";  //This is not good to import all the time
    
    "stylePreprocessorOptions":{
    "includePaths":[
          "./code"
        ]
      }

U can import simply like this

import "styles";

希望这个答案对你有所帮助
假设您有一个包含所有css代码的style.css,并且希望将其导入不同的组件以使用其代码

    lets say import "./../../code/styles.css";  //This is not good to import all the time
    
    "stylePreprocessorOptions":{
    "includePaths":[
          "./code"
        ]
      }

U can import simply like this

import "styles";
./src/styles.css(C:/Users/harul/libraryCheck/node_modules/@angular devkit/build angular/src/angular cli files/plugins/raw css loader.js!C:/Users/harulrarycheck/node_modules/postss loader/src??embedded./src/src/styles.css)模块构建失败(来自C:/Users/harul/libraryCheck/node_modules/postss loader/postss/index.js):错误:在[C:\Users\harul\libraryCheck\projects\project1\src]的C:\Users\harul\libraryCheck\node\U modules\PostCs import\lib\resolve-id.js:35:13的异步承诺中找不到“check”。所有(索引0)@import“check”;您好,我在./src/styles.css(C:/Users/harul/libraryCheck/node_modules/@angular devkit/build angular/src/angular cli files/plugins/raw css loader.js!C:/Users/harul/libraryCheck/node_modules/postss loader/src??embedded./src/styles.css)模块构建失败(来自C:/Users/harul/libraryCheck/node\u modules/postsss loader/src/index.js):错误:在C:\Users\harul\libraryCheck\projects\project1\src]的C:\Users\harul\libraryCheck\node\u modules\postss import\lib\resolve-id.js:35:13异步Promise.all(索引0)@import“check”中找不到“check”;我是这样导入的