ejs项目大名鼎鼎,应该就不需要介绍了,主要收获就是得知了实现一个模板引擎的流程,ejs是将模板作为字符串逐个解析,遇到正常的html代码,就放进一个数组中去,遇到js代码则进行过滤器、包含等的处理,最后数组join成一个可以成为Function构造函数第二个参数的字符串,构造成构造函数之后就是调用返回最终的html字符串。以下是阅读源码的笔记,因为源码中遗憾有很多说明,所以笔记很少。
image.png 更新日志 添加问题模板 添加mac gitignore配置 添加发布缩略图网址功能 添加共享功能#35 #28 #44 添加帖子内容摘录剪辑#15 修复!lg页面gotop #30 修复共享btn风格 修复a:悬停默认颜色#43 #12 修复默认的删除功能#16 修复标题行夹#48 #45 删除diy资源 删除升级配置 优化默认微信QR图像 优化更改按钮的颜色 image.png kratos ├── 404.php ├── LICENSE ├── comments.ph
(function() { var canvas = document.getElementById('quakeCanvas'); // Create our Planetary.js planet and set some initial values; // we use several custom plugins, defined at the bottom of the file var planet = planetaryjs.planet(); planet.loadPlugin(autocenter({extraHeight: -120})); planet.loadPlugin(autoscale({extraHeight: -120})); planet.loadPlugin(planetaryjs.plugins.earth({ topojson: { file: 'https://101.43.39.125/HexoFiles/js/planetaryjs/world-110m.json' }, oceans: { fill: '#001320' }, land: { fill: '#06304e' }, borders: { stroke: '#001320' } })); planet.loadPlugin(planetaryjs.plugins.pings()); planet.loadPlugin(planetaryjs.plugins.zoom({ scaleExtent: [50, 5000] })); planet.loadPlugin(planetaryjs.plugins.drag({ onDragStart: function() { this.plugins.autorotate.pause(); }, onDragEnd: function() { this.plugins.autorotate.resume(); } })); planet.loadPlugin(autorotate(5)); planet.projection.rotate([100, -10, 0]); planet.draw(canvas); // Plugin to resize the canvas to fill the window and to // automatically center the planet when the window size changes function autocenter(options) { options = options || {}; var needsCentering = false; var globe = null; var resize = function() { var width = window.outerWidth /2 + (options.extraWidth || 0); var height = window.outerHeight/2 + (options.extraHeight || 0); globe.canvas.width = width; globe.canvas.height = height; globe.projection.translate([width / 2, height / 2]); }; return function(planet) { globe = planet; planet.onInit(function() { needsCentering = true; d3.select(window).on('resize', function() { needsCentering = true; }); }); planet.onDraw(function() { if (needsCentering) { resize(); needsCentering = false; } }); }; }; // Plugin to automatically scale the planet's projection based // on the window size when the planet is initia
要使用 Commander.js 库,您必须安装 Node.js。在 Linux 上,您可以使用包管理器安装 Node。例如,在 Fedora、CentOS、Mageia 等上:
JavaScript 是一种为 Web 开发的语言,但它的用处已经远远超出了互联网的范畴。由于 Node.js 和 Electron 这样的项目,JavaScript 既是一种通用的脚本语言,也是一种浏览器组件。有专门设计的 JavaScript 库来构建命令行界面。是的,你可以在你的终端中运行 JavaScript。
目录结构 │ server.js │ ├─libs │ database.js │ ├─log ├─routers │ │ static.js │ │ │ ├─admin │ │ index.js │ │ │ ├─api │ └─www │ index.js │ ├─static │ └─upload ├─template └─upload 基础模块 cnpm i koa koa-router ko
默认情况下,生成的文件的文件名就是文件内容的 MD5 哈希值并会保留所引用资源的原始扩展名。
无论是前端开发者还是后端开发者,都会在项目中封装一些经常使用的功能方法,可以大大提高我们的开发效率
事件钩子会有不同的类型 SyncBailHook,AsyncSeriesHook,SyncHook等
运行命令后 npm让命令行工具进入node_modules/.bin目录查找是否存在webpack.sh或者webpack.cmd文件 如果存在,则执行,不存在,抛出错误(node_modules/wepback/bin/wepback.js)
我们都知道页面渲染从new Vue开始,但是实际上代码在这之前先注册了Vue构造函数和各种能力才能保证new Vue的正常运作。从开发者角度看,可以看到Vue的大致全貌,其暴露了哪些东西。
定义域名:baseUrl; 定义方法:api; 通过promise异步请求,最后导出方法。
作为一名曾经重度使用Node.js作为即时通讯客户端接入层的开发人员,无法避免调试V8,配合开发addon。于是对Node.js源码产生了很大的兴趣~
本文主要介绍了FIS(File Index System)的源码,分析了FIS的整体架构和核心模块,以及FIS的编译、部署和运行流程。同时,还详细阐述了FIS的配置文件、命令行参数、命令行工具、异常处理、日志输出、代码覆盖率、构建、依赖管理、模块导出、代码规范等内容。通过本文,读者可以了解到FIS的整体设计和实现细节,为FIS的使用和开发提供了参考。
D2Admin[1] 是一个开源的,前端中后台集成方案,原先是基于 vue-cli2,大概是向 vue-cli3 过渡时, 作者老李,想在页面右下角加个 Toggle 点击,跳到当前页面源码对应的 github 页面。
1、介绍 JSLint是一个JavaScript验证工具(非开源), 可以扫描JavaScript源代码来查找问题。如果JSLint发现一 个问题,JSLint就会显示描述这个问题的消息,并指出错误在源代码中的大致位置。有些编码风格约定可能导致未预见的行为或错误,JSLint除了能指 出这些不合理的约定,还能标志出结构方面的问题。尽管JSLint不能保证逻辑一定正确,但确实有助于发现错误,这些错误很可能导致浏览器的 JavaScript引擎抛出错误。 2、规则 JSLint 执行代码质量检测的原理核
前面已经已fis server open为例,讲解了FIS的整体架构设计,以及命令解析&执行的过程。下面就进入FIS最核心的部分,看看执行fis release这个命令时,FIS内部的代码逻辑。
mpvue小程序框架搭建很容易,官网提供vue init mpvue/mpvue-quickstart my-project, 很迅速的创建项目,但是想要结合业务等,还是要废一番功夫,今天来学学wx.request的封装,mpvue的重构,如何搭建好用的mpvue小程序架构吧
今天一起学习一下webpack5中的loader,让我们进一步加深对webpack的理解
Chameleon作为一个优秀的跨多端框架,想要实现"跨多端"这个核心目标,除了工程化配置之外,DSL层面对于各个端的转化的能力也是必不可少的,接下来将为大家介绍CML是如何做DSL层面的转化的。由于这部分只涉及到模板部分,也就是template标签中的内容转化,接下来所有提到的DSL都指的是模板内容。想了解更多有关CML跨端解决方案的内容,请访问 https://cml.didi.cn
微信小程序 页面跳转 传递参数的这个知识点我们在开发过程之中会经常遇到,记录一下,虽然很简单,但是对于刚刚接触的人来说,看文档不如看demo来的快和方便。 先看一下官方给出的文档:
多页面 html 生成 let path = require('path') let htmlWebpackPlugin = require('html-webpack-plugin') functi
vue-chartjs 是 Vue 对于 Chart.js 的封装. 你可以很简单的创建可复用的图表组件.
但是onerror事件无法捕获到网络异常的错误(资源加载失败、图片显示异常等),例如img标签下图片url 404 网络请求异常的时候,onerror无法捕获到异常,此时需要监听unhandledrejection。
说明 由于我是一个有着一颗玻璃心的博主,导致在2018年后博客很少更新。原因是由于我的分享并没有解决到部分人的问题,而导致被骂了。当时这颗玻璃心就碎了,所以这两年以来很是消极,博客很少更新。这里给那些关注我,支持我的朋友说声【对不起】!前段时间,看了一个工作两年时间博主的 2021 年 flag,突然回首,还有很多记忆。所以,我决定以后每周最少一篇博客,记录我的学习和成长。谢谢! 需求场景 小程序开发完成,接到需求:需要对小程序的所有页面【onLoad】生命周期进行埋点,对页面中的点击事件进行埋点。
由于使用css控制文字只显示多行,超出部分显示省略号,存在一定的兼容性问题,所以总结了一下网上一些大咖使用js实现控制行数的解决方案。
原创不易,未经作者允许禁止转载!! 认识Loader Loader可以用于对模块的源代码进行转换; 在加载这个模块时,webpack其实并不知道如何对其进行加载,我们必须定制对应的loader来完成这个功能。 loader配置方式 内联方式:import "css-loader!../css/index.css"; loader和文件路径用!分隔 配置方式:webpack.config.js 配置方式表示的意思是在我们的webpack.config.js文件中写明配置信息 module.rules中允许我
driver.switch_to.frame(通过find_element_by函数定位的frame、iframe标签对象)
为了加深对vue的理解,之前我们实现了一版mini-vue现在我们来看真正的vue源码来看下到底vue是如何实现的.
Vue作为当下最流行的渐进式的js框架,其渐进式的思想、虚拟DOM的运用、组件化的开发模式、响应式数据侦听原理值得开发者进行探索学习,其中运用的代码组织的技巧,对平时的开发大有裨益。本系列笔记初步分为8个章节,记录本人源码的阅读过程。
系列文章传送门: 1、build/webpack.base.conf.js 2、build/webpack.prod.conf.js 3、build/webpack.dev.conf.js 4、build/utils.js 5、build/vue-loader.conf.js 6、build/build.js 7、build/dev-server.js 8、build/check-versions.js 9、../config/index.js 下面是build/utils.js中相关代码和配置的说明 项
vue已是目前国内前端web端三分天下之一,同时也作为本人主要技术栈之一,在日常使用中知其然也好奇着所以然,另外最近的社区涌现了一大票vue源码阅读类的文章,在下借这个机会从大家的文章和讨论中汲取了一些营养,同时对一些阅读源码时的想法进行总结,出产一些文章,作为自己思考的总结,本人水平有限,欢迎留言讨论~
video.js是一个很好的视频播放插件,但是如果移植到vue上相信很多小伙伴很苦恼,是不是网上搜了一堆,发现不好使,我也是踩坑了,后来发现官方文档上就有,好尴尬,建议以后学习先看看官方文档,会有惊喜的。 1.首先安装video.js,然后在main.js中引入
在前天的公众号文章《别去送死了。Selenium 与 Puppeteer 能被网站探测的几十个特征》中,我们提到目前网上的反检测方法几乎都是掩耳盗铃,因为模拟浏览器有几十个特征可以被检测,仅仅隐藏 webdriver 这一个值是没有任何意义的。
运行以上程序,在右侧第二个窗口中执行了 /error 路由,因为没有定义 a 这个对象,则会引发错误。
本文主要介绍了EasyUI中的一些组件和模块,包括表格、日历、表单、对话框、颜色选择器等。通过这些组件和模块,可以快速搭建出各种类型的应用程序。同时,还介绍了一些EasyUI中的实用工具,包括easyui-lang-zh、easyui-validate、easyui-component-extend等。这些工具可以帮助开发者更加灵活地开发和管理系统。
Vue.js是现在国内比较火的前端框架,希望通过接下来的一系列文章,能够帮助大家更好的了解Vue.js的实现原理。本次分析的版本是Vue.js2.5.16。(持续更新中。。。)
后台管理系统,是内容管理系统Content Manage System(简称CMS)的一个子集。CMS是Content Management System的缩写,意为"内容管理系统"。 根据自己的业务提供不同模块,如商品管理、订单管理、财务管理等等。
随着 Vue.js 越来越火,Vue.js 的相关插件也在不断的被贡献出来,数不胜数。比如官方推荐的 vue-router、vuex 等,都是非常优秀的插件。但是我们更多的人还只停留在使用的阶段,比较少自己开发。所以接下来会通过一个简单的 vue-toast 插件,来了解掌握插件的开发和使用。
Yeoman 生成的 Angular 脚手架提供了 27 个任务配置和 3 个自定义任务。这三个自定义任务分贝为:
AS3JS是ActionScript 3.0到JavaScript的转换器,它基本上可以让你使用ActionScript 3.0语言编写客户端和服务器端JavaScript应用程序。AS3JS是不是一个框架。此工具也没有设计成用于转换的Flash到HTML5解决方案(虽然它可能会帮助!)。现在AS3JS纯粹是转换器,但是你可以自由的扩展它,如果你愿意,因为它是开源的。
要回答这个问题,我们现将视线放到Vue源码中package.json文件中,有这么两行代码:
1、node环境安装 http://www.runoob.com/nodejs/nodejs-install-setup.html 2、grunt安装 package.json文件 http://blog.csdn.net/zmrdlb/article/details/53190696 { "name": "payment", "version": "0.0.1", "author": "zhangxu", "devDependencies": { "grunt": "^0.4.5"
写在前面,本文阅读需要一定Nodejs的相关知识,因为会扩展webpack的相关功能,并且实现需要遵守一定约定和Ajax封装。
在windows下,我们做js构建工作,都习惯安装grunt-cli,只需要命令行grunt。。。一切构建工作都自动完成了。这已经是很完美的情况了,不过最近要做一个服务器版的自动化构建系统,在nodejs中调用批处理执行grunt就显得很矬,而且各种问题。是否有更好,更漂亮的方式呢? grunt本来就是nodejs程序,安装后表现为一个node_module,那么cli是什么呢?这只是一个nodejs写的命令行界面。所以,nodejs肯定可以直接在js层面调用grunt。 我们需要做的,只需要揭开cli的面
领取专属 10元无门槛券
手把手带您无忧上云