【问题标题】:converting style css to scss将样式 css 转换为 scss
【发布时间】:2020-02-09 22:49:51
【问题描述】:

我正在尝试将我当前的 Angular 8 项目 style.css 转换为 sass 但编译器错误

我尝试手动更改“原理图”:{ “@schematics/角度:组件”:{ "styleext": "scss"

我想转换样式表,谁能帮帮我

【问题讨论】:

  • 你能显示详细的错误吗?您是否在 angular.json 文件中更改为 src/style.scss
  • 是的,当我这样做时,它在控制台中出错 this => (./node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/raw-css-loader .js!./node_modules/postcss-loader/src??embedded!./src/styles.css)

标签: javascript angular typescript sass angular8


【解决方案1】:

检查你的 angular.json 看看这些配置是否存在

"schematics": {
   "@schematics/angular:component": {
        "style": "scss"
     }
    },
"architect": {
    "build": {
        "builder": "@angular-devkit/build-angular:browser",
        "options": {
        "outputPath": "dist/testssss",
        "index": "src/index.html",
        "main": "src/main.ts",
        "polyfills": "src/polyfills.ts",
        "tsConfig": "tsconfig.app.json",
        "aot": false,
        "assets": [
            "src/favicon.ico",
            "src/assets"
        ],
        "styles": [
            "src/styles.scss"
        ],
        "scripts": []
    },

还要确保将您的 css 文件更改为 scss 扩展名

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-05-24
    • 2012-11-18
    • 1970-01-01
    • 1970-01-01
    • 2021-05-11
    • 2022-01-25
    • 2018-02-19
    • 1970-01-01
    相关资源
    最近更新 更多