包管理工具
-
npm
- npm init 初始化 创建 package.json文件,包的配置文件
- npm i name 安装工具
-S --save 记录在[dependencies] 生产依赖
-D --save-dev 记录在 [devDependencies] 开发依赖
-g global 全局
-
npm i 根据 package.json 依赖声明安装依赖
-
npm remove
-
rm
-
r
-
npm remove less -g
-
yarn
-
yarn init
-
yarn add jquery 局部安装
-
yarn add babel --dev 开发依赖
-
yarn global add less 全局安装
-
yarn 此命令往往用于克隆回来的仓库内没有包工具 依据package.json安装管理工具
-
yarn remove jquery
-
yarn global remove less
-
yarn 与 npm 进行命令的执行
-
npm run 别名
-
yarn run 别名
网站的根目录
nodejs 模块化
暴露数据
- module.exports
- exports.xxx
引入数据
- require
- 建议使用相对路径
- js与json 引入