Skip to content

Instantly share code, notes, and snippets.

@dstyle0210
Last active July 12, 2016 02:12
Show Gist options
  • Select an option

  • Save dstyle0210/2831be26286453fbab0b76d62c6c8e75 to your computer and use it in GitHub Desktop.

Select an option

Save dstyle0210/2831be26286453fbab0b76d62c6c8e75 to your computer and use it in GitHub Desktop.
[node] file path에서 자신의 바로상위 폴더명 가져오기.
var path = require('path');
function getFolder(file){
return path.parse( path.parse(file.path).dir ).base;
};
var pathUrl = "/src/css/test.css";
var myFolder = getFolder(pathUrl); // return "css"
console.log(myFolder);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment