准备工作
Hexo安装完毕,执行完毕hexo init. 可以本地访问.
如果NPM有下载问题,请使用cnpm CNPM
另外强烈推荐git bash
插件简介
很多人不理解为什么要有插件,因为我们已经被浏览器的插件烦透了对吗? 没错。不受控的插件只会把用户搞疯狂。
但是受控的插件,可以锦上添花
确定需求
插件存在的意义是,一定要解决用户痛点。本文实例只会打印一句log,很显然没人会用这个插件。只能demo:)
新建package.json文件
在你的hexo blog目录,找到node_modules. 新建一个文件夹。然后执行npm init
npm会引导你生成package.json 这是你的包的描述文件。需要注意的是,所有的hexo插件必须以hexo-开头,否则hexo不会加载。
mkdir hexo-your-mod
cd hexo-your-mod
npm init
根据提示输入信息:
$ npm init
...
package name: (mytest) hexo-remote-writting
version: (1.0.0) 0.0.1
description: A hexo plugin to support writting post remotely
entry point: (index.js)
test command:
git repository:
keywords: hexo plugin remote writting
author: yourname
license: (ISC