Angular CLI 1.4.1,ng总是生成spec文件,css甚至默认前缀是scss

时间:2017-09-10 11:02:58

标签: node.js angular angular-cli angular-components

我最近将Angular CLI版本更新为1.4.1,更新后我创建了新的

项目使用以下命令

import numpy as np
from keras import backend as K
from keras.layers import Dense, LSTM, Activation
from keras.models import Sequential
from  keras.regularizers import Regularizer

class ZeroWeights(Regularizer):
    def __init__(self, l1=0., N = 0):
        self.l1 = K.cast_to_floatx(l1)
        self.N = int(N)

    def __call__(self, x):
        regularization = 0.
        if self.l1 and self.N:
            regularization += self.l1 * np.abs((self.N - np.count_nonzero(x))) 
        return regularization

    def get_config(self):
        return {'l1': float(self.l1),
                'N': int(self.N)}

model1 = Sequential() 

look_back = 10
dm = 5

model1.add(
    LSTM(64, input_shape = (look_back,dm), W_regularizer=ZeroWeights(0.1, 1331), 
         activation='sigmoid'))
model1.add(Dense(dm)) 
model1.add(Activation("linear")) 
model1.compile(loss='mean_squared_error', optimizer='rmsprop') 
model1.summary();

当我在命令下运行创建新组件时,我看到它仍然生成spec文件以及样式文件扩展名也是CSS。

请参阅以下输出

 F:\Projects\MyCLIProject>ng new FlexCSS --prefix=cf --skip-install --skip-git  --style=scss --skip-tests

我不知道它是发生在我身上还是其他人也面临同样的问题。

我多次创建项目以及重新安装角度cli而不清除npm缓存。

这是我的 .angular-cli.json

F:\Projects\MyCLIProject>ng g c textComp
  create src/app/text-comp/text-comp.component.html (28 bytes)
  create src/app/text-comp/text-comp.component.spec.ts (643 bytes)
  create src/app/text-comp/text-comp.component.ts (280 bytes)
  create src/app/text-comp/text-comp.component.css (0 bytes)
  update src/app/app.module.ts (406 bytes)

这是我的ng版本

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "project": {
    "name": "MyCLIProject"
  },
  "apps": [
    {
      "root": "src",
      "outDir": "dist",
      "assets": [
        "assets",
        "favicon.ico"
      ],
      "index": "index.html",
      "main": "main.ts",
      "polyfills": "polyfills.ts",
      "test": "test.ts",
      "tsconfig": "tsconfig.app.json",
      "testTsconfig": "tsconfig.spec.json",
      "prefix": "cf",
      "styles": [
        "styles.scss"
      ],
      "scripts": [],
      "environmentSource": "environments/environment.ts",
      "environments": {
        "dev": "environments/environment.ts",
        "prod": "environments/environment.prod.ts"
      }
    }
  ],
  "e2e": {
    "protractor": {
      "config": "./protractor.conf.js"
    }
  },
  "lint": [
    {
      "project": "src/tsconfig.app.json"
    },
    {
      "project": "src/tsconfig.spec.json"
    },
    {
      "project": "e2e/tsconfig.e2e.json"
    }
  ],
  "test": {
    "karma": {
      "config": "./karma.conf.js"
    }
  },
  "defaults": {
    "styleExt": "scss",
    "component": {
      "spec":false
     }
  }
}

0 个答案:

没有答案