1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | module.exports = (filePath)=>{
|
10 | const {path,pathInfo} = {
|
11 | path:require('path'),
|
12 | pathInfo:require('./getPathInfo')
|
13 | };
|
14 |
|
15 | let fileType = path.extname(filePath).toLowerCase(),
|
16 | isSpriteDir = (()=>{
|
17 | let adirNames = path.dirname(filePath).split(path.sep),
|
18 | dirName = adirNames[adirNames.length - 1].toLowerCase();
|
19 | return dirName.indexOf('_sprite') === 0;
|
20 | })(),
|
21 | isImg = fileType === '.png' || fileType === '.svg';
|
22 |
|
23 | return isSpriteDir && isImg;
|
24 | }; |
\ | No newline at end of file |