hexo-generator-amp
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -10,2 +10,8 @@ | ||
function isHexoWorkingDir(){ | ||
var themeDir = pathFn.join(process.env.PWD , "themes") | ||
var flg = fs.existsSync(themeDir); | ||
return flg; | ||
} | ||
module.exports.initCopy = function(assetDirName, assetFiles){ | ||
@@ -15,3 +21,4 @@ | ||
var hexoAssetPath_sampleDir = pathFn.join(process.env.PWD , assetDirName , "sample"); | ||
if(!fs.existsSync(hexoAssetPath)){ | ||
if(!fs.existsSync(hexoAssetPath) && isHexoWorkingDir() ){ | ||
//create dir | ||
@@ -22,3 +29,3 @@ mkdirp.sync( hexoAssetPath_sampleDir ); | ||
for(var i=0; i< assetFiles.length; i++){ | ||
if(!fs.existsSync( pathFn.join(hexoAssetPath_sampleDir , pathFn.basename(assetFiles[i])) )){ | ||
if(!fs.existsSync( pathFn.join(hexoAssetPath_sampleDir , pathFn.basename(assetFiles[i])) ) && isHexoWorkingDir() ){ | ||
mkdirp.sync( pathFn.dirname( pathFn.join(hexoAssetPath_sampleDir , pathFn.basename(assetFiles[i])) )); | ||
@@ -36,5 +43,5 @@ fs.createReadStream( pathFn.join(__dirname , assetFiles[i]) ).pipe(fs.createWriteStream( pathFn.join(hexoAssetPath_sampleDir , pathFn.basename(assetFiles[i])) )); | ||
//copy asset dir | ||
if( !fs.existsSync(pathFn.join(process.env.PWD , "source" , distDirName)) )mkdirp.sync( pathFn.join(process.env.PWD , "source" , distDirName) ); | ||
if( !fs.existsSync(pathFn.join(process.env.PWD , "source" , distDirName)) && isHexoWorkingDir() )mkdirp.sync( pathFn.join(process.env.PWD , "source" , distDirName) ); | ||
for(var i=0; i< copyFiles.length; i++){ | ||
if(fs.existsSync( pathFn.join(hexoAssetPath , copyFiles[i]) )){ | ||
if(fs.existsSync( pathFn.join(hexoAssetPath , copyFiles[i]) ) && isHexoWorkingDir() ){ | ||
// fs.createReadStream( pathFn.join(hexoAssetPath , copyFiles[i]) ).pipe(fs.createWriteStream( pathFn.join(process.env.PWD , "source" , distDirName , pathFn.basename(copyFiles[i])) )); | ||
@@ -41,0 +48,0 @@ mkdirp.sync( pathFn.dirname( pathFn.join(process.env.PWD , "source" , distDirName , copyFiles[i]))); |
@@ -470,3 +470,3 @@ 'use strict'; | ||
return { | ||
path: post.path+"amp/index.html", | ||
path: pathFn.join(post.path , "amp/index.html"), | ||
data: xml | ||
@@ -479,3 +479,3 @@ }; | ||
return { | ||
path: post.path+"amp/index.html", | ||
path: pathFn.join(post.path , "amp/index.html"), | ||
data: cachedData.xml | ||
@@ -482,0 +482,0 @@ } |
@@ -17,3 +17,3 @@ | ||
// console.log("画像パス判定(1): "+ "_posts/**/記事.mdと同階層化に画像がある"); | ||
imgDevPath = data.asset_dir + pathFn.basename(imgsrc); | ||
imgDevPath = pathFn.join(data.asset_dir , pathFn.basename(imgsrc) ); | ||
@@ -20,0 +20,0 @@ }else{ |
{ | ||
"name": "hexo-generator-amp", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"main": "index", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
102162
2543
17