|
@@ -2,11 +2,11 @@
|
|
// We fire our own build-examples.js and tell it which example to build -
|
|
// We fire our own build-examples.js and tell it which example to build -
|
|
// that script then writes temporary js files
|
|
// that script then writes temporary js files
|
|
// which we return via the callback.
|
|
// which we return via the callback.
|
|
-var exec = require('child_process').exec
|
|
|
|
-var path = require('path')
|
|
|
|
-var fs = require('fs')
|
|
|
|
-var uuid = require('uuid')
|
|
|
|
-var webRoot = path.dirname(path.dirname(__dirname))
|
|
|
|
|
|
+var exec = require('child_process').exec
|
|
|
|
+var path = require('path')
|
|
|
|
+var fs = require('fs')
|
|
|
|
+var uuid = require('uuid')
|
|
|
|
+var webRoot = path.dirname(path.dirname(__dirname))
|
|
var browserifyScript = webRoot + '/build-examples.js'
|
|
var browserifyScript = webRoot + '/build-examples.js'
|
|
|
|
|
|
function parseExamplesBrowserify (data, options, callback) {
|
|
function parseExamplesBrowserify (data, options, callback) {
|
|
@@ -19,9 +19,9 @@ function parseExamplesBrowserify (data, options, callback) {
|
|
}
|
|
}
|
|
|
|
|
|
// var slug = data.path.replace(/[^a-zA-Z0-9\_\.]/g, '-')
|
|
// var slug = data.path.replace(/[^a-zA-Z0-9\_\.]/g, '-')
|
|
- var slug = uuid.v4()
|
|
|
|
|
|
+ var slug = uuid.v4()
|
|
var tmpFile = '/tmp/' + slug + '.js'
|
|
var tmpFile = '/tmp/' + slug + '.js'
|
|
- var cmd = 'node ' + browserifyScript + ' ' + data.path + ' ' + tmpFile + ' --colors'
|
|
|
|
|
|
+ var cmd = 'node ' + browserifyScript + ' ' + data.path + ' ' + tmpFile + ' --colors'
|
|
// hexo.log.i('hexo-renderer-uppyexamples: change detected in examples. running: ' + cmd);
|
|
// hexo.log.i('hexo-renderer-uppyexamples: change detected in examples. running: ' + cmd);
|
|
exec(cmd, function (err, stdout, stderr) {
|
|
exec(cmd, function (err, stdout, stderr) {
|
|
if (err) {
|
|
if (err) {
|