Last active
July 12, 2016 02:12
-
-
Save dstyle0210/2831be26286453fbab0b76d62c6c8e75 to your computer and use it in GitHub Desktop.
[node] file path에서 자신의 바로상위 폴더명 가져오기.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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