Skip to content

Commit

Permalink
build: downgrade less from 3.x to 2.7.x
Browse files Browse the repository at this point in the history
  • Loading branch information
cipchk committed May 16, 2018
1 parent 61ef994 commit 709cfea
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 42 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ before_script:
- npm install -g yarn

script:
- npm run fix-v6
- npm run $TASK
- |
if [ "$TASK" = "test" ]; then
Expand Down
16 changes: 4 additions & 12 deletions docs/changelog-v6.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,22 +79,14 @@ v6 的文件结构有点小调整,虽然不影响,但你依然需要知道

### 6、less 的修复

antd 的 less 文件有点反人类,而 Angular cli 目前又有一个小BUG导致,无法编译 ng-zorro-antd 样式,你可以在 `package.json``scripts` 节点增加
受限于 [#10430](https://github.com/angular/angular-cli/issues/10430),需要将 less 强制降级为 `2.7`,在 `package.json``devDependencies` 增加

```
"fix-v6": "node fix-v6"
devDependencies: [
"less": "~2.7.0"
]
```

并复制 [fix-v6.js](https://github.com/cipchk/ng-alain/blob/master/fix-v6.js) 到你的项目根目录下,最后执行:

```bash
npm run fix-v6.js
```

**注:** 只需要执行一次即可,在执行之前**务必**先运行 `npm i` 安装所有依赖包,若依赖包重新安装也必须再执行一次。

这些方式只是一种临时解决办法,有关细节关注 [#10430](https://github.com/angular/angular-cli/issues/10430) 进展。

**styles.less**

修改 `./src/styles.less` 的第三方类库的引用方式,应该说目录并不支持 `~@delon` 这种写法,统一采用 `node_modules/@delon`
Expand Down
23 changes: 0 additions & 23 deletions fix-v6.js

This file was deleted.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@
"scaffold:release_optional": "bash ./scaffold.sh -b",
"scaffold:gh": "bash ./scaffold.sh -b -d",
"scaffold:public": "cd ./scaffold && npm publish --access=public",
"scaffold:public:next": "cd ./scaffold && npm publish --tag next --access=public",
"fix-v6": "node fix-v6"
"scaffold:public:next": "cd ./scaffold && npm publish --tag next --access=public"
},
"dependencies": {
"@angular/animations": "^6.0.0",
Expand Down Expand Up @@ -132,7 +131,8 @@
"tslint-language-service": "^0.9.9",
"typescript": "~2.7.2",
"webpack-bundle-analyzer": "^2.11.2",
"xlsx": "^0.12.12"
"xlsx": "^0.12.12",
"less": "~2.7.0"
},
"lint-staged": {
"*.{cmd,html,json,md,sh,txt,xml,yml}": [
Expand Down
2 changes: 0 additions & 2 deletions scaffold.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ if [[ ${BUILD} == true ]]; then

npm i

node ./fix-v6.js

echo '===== build...'
$(npm bin)/ng build --prod --build-optimizer --base-href /ng-alain/

Expand Down
1 change: 0 additions & 1 deletion site.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ if [[ ${BUILD} == true ]]; then
sed -e "s/~ng-zorro-antd/..\/..\/..\/..\/..\/node_modules\/ng-zorro-antd/g" packages/theme/styles/app/mixins/index.less > .tmp/theme/styles/app/mixins/index.less

node ./scripts/site/generate-color-less.js
node ./fix-v6.js

rm -rf .tmp

Expand Down

0 comments on commit 709cfea

Please sign in to comment.