Coder Social home page Coder Social logo

scripts功能 about hexo HOT 6 CLOSED

hexojs avatar hexojs commented on August 27, 2024
scripts功能

from hexo.

Comments (6)

tommy351 avatar tommy351 commented on August 27, 2024 1
hexo.on('newPost', function(){

改為

hexo.on('newPost', function(target){

from hexo.

tommy351 avatar tommy351 commented on August 27, 2024

函數內有引入target變數嗎?

var spawn = require('child_process').spawn;

hexo.on('newPost', function(target){
  spawn('open', [target]);
});

from hexo.

pharaohnie avatar pharaohnie commented on August 27, 2024

这个就不太懂了,因为不是搞开发的。我的系统是mac os 10.8.2,想直接调用Mou编辑blog的话,这个script应该怎么写?在 2013-1-7,上午10:47,SkyArrow [email protected] 写道:函數內有引入target變數嗎?

var spawn = require('child_process').spawn;

hexo.on('newPost', function(target){
spawn('open', [target]);
});

          —
          Reply to this email directly or view it on GitHub.

from hexo.

tommy351 avatar tommy351 commented on August 27, 2024

像那樣寫應該就會自動開啟對應的Markdown編輯器了

from hexo.

pharaohnie avatar pharaohnie commented on August 27, 2024

但是确实报错了hexo$ cat scripts/autoopen var spawn = require('child_process').spawn;hexo.on('newPost', function(){    spawn('open', [target]);});报错信息:hexo$ hexo new_post 'test'Post created at /Users/pharaohnie/hexo/source/_posts/2013-01-07-test.md/Users/pharaohnie/hexo/scripts/autoopen:4    spawn('open', [target]);                   ^ReferenceError: target is not defined    at EventEmitter.<anonymous> (/Users/pharaohnie/hexo/scripts/autoopen:4:20)    at EventEmitter.emit (events.js:96:17)    at /usr/local/share/npm/lib/node_modules/hexo/lib/cli/new.js:46:14    at fs.close (/usr/local/share/npm/lib/node_modules/hexo/node_modules/graceful-fs/graceful-fs.js:90:5)    at Object.oncomplete (fs.js:297:15)在 2013-1-7,上午10:53,SkyArrow [email protected] 写道:像那樣寫應該就會自動開啟對應的Markdown編輯器了

Reply to this email directly or view it on GitHub.

from hexo.

pharaohnie avatar pharaohnie commented on August 27, 2024

这回ok了,感谢!在 2013-1-7,上午11:02,SkyArrow [email protected] 写道:hexo.on('newPost', function(){
改為

hexo.on('newPost', function(target){

          —
          Reply to this email directly or view it on GitHub.

from hexo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.