当前位置: 首页 > news >正文

外贸谷歌网站推广上海seo优化公司 kinglink

外贸谷歌网站推广,上海seo优化公司 kinglink,长沙3合1网站建设电话,千万不要去电商公司上班作为一个菜鸟#xff0c;我有一颗好奇的心#xff0c;每当vue init 的时候#xff0c;看到那流畅的进度和神奇的结果#xff0c;心里都充满一窥其本质的期望…… 以下就是我不断的console#xff0c;大致理出来的一个流程心得#xff0c;纪录在此#xff0c;以作备忘。 … 作为一个菜鸟我有一颗好奇的心每当vue init 的时候看到那流畅的进度和神奇的结果心里都充满一窥其本质的期望…… 以下就是我不断的console大致理出来的一个流程心得纪录在此以作备忘。 1、which vue定位vue命令的实际位置   2、去往命令vue的目录查看代码 这里的commander包是用来创建命令行的工具其npm官网粗略了解了解到其中的init、list命令会在当前目录寻找执行vue-init、vue-list文件 The commander will try to search the executables in the directory of the entry script (like ./examples/pm) with the name program-command, like pm-install, pm-search.   3、查看vue-init文件及其代码 通过ls命令我们可以看到命令文件的真实位置是在全局node_modules下的vue-cli里面所以代码里的require包都是从vue-cli包下找的 这个文件就是init命令的主体了里面主要有 download-git-repo、inquirer等包 和 cli/lib下的功能函数 check-version、generate等   3.1、check-version 的作用 首先其会比对vue-cli的package.json里的node版本和当前process.version的环境版本如果环境版本低就会报错。 其次其会请求线上vue-cli的最新版本来告诉用户是否有新的vue-cli版本可以更新只是给用户一个提示 const request require(request) const semver require(semver) const chalk require(chalk) const packageConfig require(../package.json)module.exports done {// Ensure minimum supported node version is usedif (!semver.satisfies(process.version, packageConfig.engines.node)) {return console.log(chalk.red( You must upgrade node to packageConfig.engines.node .x to use vue-cli))}request({url: https://registry.npmjs.org/vue-cli,timeout: 1000}, (err, res, body) {if (!err res.statusCode 200) {const latestVersion JSON.parse(body)[dist-tags].latestconst localVersion packageConfig.versionif (semver.lt(localVersion, latestVersion)) {console.log(chalk.yellow( A newer version of vue-cli is available.))console.log()console.log( latest: chalk.green(latestVersion))console.log( installed: chalk.red(localVersion))console.log()}}done()}) }3.2 、download-git-repo的作用 用来通过git clone 或者  http下载的方式从github、gitlab等平台下载仓库代码具体可去官网查看 默认我们没有指定clone参数程序会从 https://github.com/vuejs-templates/webpack/archive/master.zip 下载模版 如果用 vue init webpack -c 则会通过 git clone gitgithub.com:vuejs-templates/webpack.git 来下载(本地配置sshkey可以下载私有库) tmp变量是临时存放模版的目录默认在 ~/.vue-templates/   const tmp path.join(home, .vue-templates, template.replace(/[\/:]/g, -)) …… download(template, tmp, { clone }, err {spinner.stop()if (err) logger.fatal(Failed to download repo template : err.message.trim())generate(name, tmp, to, err {if (err) logger.fatal(err)logger.success(Generated %s., name)}) })如果我们要配置自己项目的模版目录就好好看看vue-init文件里的run函数吧 ^_^祝你成功^_^。 3.3、inquirer的作用 起到一个prompt confirm的作用 Generate project in current directory? Target directory exists. Continue?   3.4、generate函数的作用 主要代码   metalsmith.clean(false).source(.) // start from template root instead of ./src which is Metalsmiths default for source.destination(dest).build((err, files) {done(err)if (typeof opts.complete function) {const helpers { chalk, logger, files }opts.complete(data, helpers)} else {logMessage(opts.completeMessage, data)}})下载完模版后的处理逻辑都在这里面了函数文件位于 vue-cli/lib/generate.js这里面主要用了 metalsmith、handlebars等包 和 lib/options.js options.js 会去 ~/.vue-templates/模版 目录下获取 meta.js 或者 meta.json 中的配置。 这个配置就是用来配置图中的东西。   3.4.1、metalsmith 的作用 类似于gulp是一个流程工具英文不好我看它看的头疼只知道它干了什么但不知道它是怎么做的。 它会配置options.js里获取的配置数据对模版文件进行过滤   3.4.2、handlebars 的作用 一个js模版工具类似服务端的smarty、前端的artemplate、es6的字符串模版等。 它会在metalsmith的流程里处理模版里的变量把我们填写的项目名等数据渲染成最终的文件写进当前项目目录里。《完》   很久没写博客写着好别扭啊不支持markdown只能凭感觉来写了估计预览起来会很难看希望大家见谅。 最后吟诗一首 “众鸟高飞尽孤云独去闲。相看两不厌只有敬亭山。”   转载于:https://www.cnblogs.com/wshiqtb/p/10697804.html
http://www.zqtcl.cn/news/607375/

相关文章:

  • 福建人力资源建设网站未成年在线观看视频播放免费
  • 网站站内logo怎么做朋友圈广告30元 1000次
  • 绍兴做网站北京做公司网站
  • 青浦区网站建设公司商丘网站建设费用
  • 百度网站是怎么建设的wordpress媒体主题
  • 孝感网站建设xgsh国内比百度好的搜索引擎
  • 阅读网站怎样做网站右侧固定标题怎么做
  • 网站开发多少钱农民wordpress acf破解版
  • 厦门网站建设培训云南最便宜的网站建设
  • 吉安手机网站建设html网页布局
  • wordpress英文文章格式怎样给网站做优化
  • 新网站友链网店托管公司
  • 期末作业制作网站网站上传根目录
  • 新网站不被收录的原因兰州网络seo公司
  • 男生可以做网站编辑工作吗网站域名跟谁买
  • 我市精神文明建设的门户网站做网站需要写代码
  • 新网站推广网站搜索引擎优化的步骤
  • 网站建设20推广公司网站建设推广方案
  • 如何设计酒店网站建设好的交互网站
  • 怎么把自己的网站放到百度上九亭做网站
  • 张家界旅游网站建设网页设计作品欣赏分析
  • 订阅号自定义可以做链接网站不做网站dreamwa
  • 电子商务网站规划的原则做网站的集群方案
  • 山东建设银行怎么招聘网站自己做商城网站
  • 建设网站成本预算网站页面设计尺寸
  • 微官网和微网站首页房产网怎么查到房产
  • 高端服装产品网站建设织梦网站识别
  • 做调像什么网站找活注册网站请签署意见是写无
  • 郑州公司网站设计深圳福田有哪些公司
  • 怎么看网站是谁做的asp企业网站开发技术