How to create a new angularjs project based on WebStorm

Create a empty project

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

add file .gitignore

echo ".idea" > .gitignore 

Install bower

sudo cnpm install -g bower

Initialize the project based on bower

harbin@shangluo:~/Public/project/lanzhou/angular-start$ bower init
? name angular-start
? description How to start a learning journey about angular
? main file index.html
? keywords 
? authors lwk <qwfys200@qq.com>
? license MIT
? homepage https://blog.csdn.net/qwfys200
? set currently installed components as dependencies? Yes
? add commonly ignored files to ignore list? Yes
? would you like to mark this package as private which prevents it from being accidentally published to the registry? Yes

{
  name: 'angular-start',
  authors: [
    'lwk <qwfys200@qq.com>'
  ],
  description: 'How to start a learning journey about angular',
  main: 'index.html',
  license: 'MIT',
  homepage: 'https://blog.csdn.net/qwfys200',
  private: true,
  ignore: [
    '**/.*',
    'node_modules',
    'bower_components',
    'test',
    'tests'
  ]
}

? Looks good? Yes
harbin@shangluo:~/Public/project/lanzhou/angular-start$
harbin@shangluo:~/Public/project/lanzhou/angular-start$ ll
total 24
drwxrwxr-x  4 harbin harbin 4096 Feb 25 15:56 ./
drwxrwxr-x 19 harbin harbin 4096 Feb 25 15:33 ../
-rw-rw-r--  1 harbin harbin  355 Feb 25 15:56 bower.json
-rw-rw-r--  1 harbin harbin    6 Feb 25 15:51 .gitignore
drwxrwxr-x  2 harbin harbin 4096 Feb 25 15:39 .idea/
drwxrwxr-x  5 harbin harbin 4096 Feb 25 15:36 public/
harbin@shangluo:~/Public/project/lanzhou/angular-start$
harbin@shangluo:~/Public/project/lanzhou/angular-start$ cat bower.json 
{
  "name": "angular-start",
  "authors": [
    "lwk <qwfys200@qq.com>"
  ],
  "description": "How to start a learning journey about angular",
  "main": "index.html",
  "license": "MIT",
  "homepage": "https://blog.csdn.net/qwfys200",
  "private": true,
  "ignore": [
    "**/.*",
    "node_modules",
    "bower_components",
    "test",
    "tests"
  ]
}
harbin@shangluo:~/Public/project/lanzhou/angular-start$

add README.md file

echo '# angular-start' > README.md

Git

git init

git init

git remote add

git remote add orgin git@gitee.com:ab-sample/angular-start.git
git add .
git commit -m 'init repository'
git push orgin master

Others

add file .bowerrc

tee .bowerrc <<-'EOF'
{
  "directory": "public/components"
}
EOF

Install angular

harbin@shangluo:~/Public/project/lanzhou/angular-start$ bower install angular#1.4.6 --save
bower angular#1.4.6             cached https://github.com/angular/bower-angular.git#1.4.6
bower angular#1.4.6           validate 1.4.6 against https://github.com/angular/bower-angular.git#1.4.6
bower angular#1.4.6            install angular#1.4.6

angular#1.4.6 public/components/angular
harbin@shangluo:~/Public/project/lanzhou/angular-start$
harbin@shangluo:~/Public/project/lanzhou/angular-start$ tree public/
public/
├── components
│   └── angular
│       ├── angular-csp.css
│       ├── angular.js
│       ├── angular.min.js
│       ├── angular.min.js.gzip
│       ├── angular.min.js.map
│       ├── bower.json
│       ├── index.js
│       ├── package.json
│       └── README.md
├── css
├── img
└── js

5 directories, 9 files
harbin@shangluo:~/Public/project/lanzhou/angular-start$
harbin@shangluo:~/Public/project/lanzhou/angular-start$ cat bower.json 
{
  "name": "angular-start",
  "authors": [
    "lwk <qwfys200@qq.com>"
  ],
  "description": "How to start a learning journey about angular",
  "main": "index.html",
  "license": "MIT",
  "homepage": "https://blog.csdn.net/qwfys200",
  "private": true,
  "ignore": [
    "**/.*",
    "node_modules",
    "bower_components",
    "test",
    "tests"
  ],
  "dependencies": {
    "angular": "1.4.6"
  }
}
harbin@shangluo:~/Public/project/lanzhou/angular-start$ 

add ./public/index.html

tee ./public/index.html <<-'EOF'
<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>学习AngularJS 1.x</title>
</head>
<body>

</body>
</html>
EOF

引入angular.js

tee ./public/index.html <<-'EOF'
<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>学习AngularJS 1.x</title>    
</head>
<body>
    <script type="text/JavaScript" src="components/angular/angular.js"></script>
</body>
</html>
EOF

hello world

tee ./public/index.html <<-'EOF'
<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>学习AngularJS 1.x</title>
</head>
<body ng-app="">
    <h1>{{"Hello World!"}}</h1>
    <script type="text/JavaScript" src="components/angular/angular.js"></script>
</body>
</html>
EOF

run

在这里插入图片描述

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

qwfys200

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值