rbtech / css-purge

A CSS tool written in Node JS as a command line app or library for the purging, burning, reducing, shortening, compressing, cleaning, trimming and formatting of duplicate, extra, excess or bloated CSS.
http://rbtech.github.io/css-purge
MIT License
125 stars 19 forks source link

Error scanning directory with node 6 on nvm #32

Closed fstani closed 5 years ago

fstani commented 6 years ago

Using node 6.6 on nvm, there seems to be an issue with scandir, it seems to be scanning relative to the path of the css-purge module rather then the absolute path of the dir

Running this command: css-purge -i /absolute-path/to/css -o static/all.css

Directory read error: Something went wrong while reading the directory, check your [html] in config_css.json and please try again.
{ Error: ENOENT: no such file or directory, scandir '/home/fabio/.nvm/versions/node/v6.6.0/lib/node_modules/css-purge/absolute-path/to/css'
    at Error (native)
    at Object.fs.readdirSync (fs.js:951:18)
    at getFilePaths (/home/fabio/.nvm/versions/node/v6.6.0/lib/node_modules/css-purge/lib/css-purge.js:1999:10)
    at CSSPurgeEmitter.continueCSSFilesProcessAfterConfig (/home/fabio/.nvm/versions/node/v6.6.0/lib/node_modules/css-purge/lib/css-purge.js:1861:9)
    at emitOne (events.js:96:13)
    at CSSPurgeEmitter.emit (events.js:188:7)
    at readConfig (/home/fabio/.nvm/versions/node/v6.6.0/lib/node_modules/css-purge/lib/css-purge.js:1714:14)
    at CSSPurgeEmitter.continueCSSFilesProcess (/home/fabio/.nvm/versions/node/v6.6.0/lib/node_modules/css-purge/lib/css-purge.js:1908:5)
    at emitOne (events.js:96:13)
    at CSSPurgeEmitter.emit (events.js:188:7)
  errno: -2,
  code: 'ENOENT',
  syscall: 'scandir',
  path: '/home/fabio/.nvm/versions/node/v6.6.0/lib/node_modules/css-purge/absolute-path/to/css' }

BTW, this works, providing the specific file

css-purge -i /absolute-path/to/css/one.css -o static/all.css

AndrewEQ commented 6 years ago

Thanks for the feedback @fstani, will look into it asap.

AndrewEQ commented 5 years ago

Sorted it out, test and lemme know if you still have an issue.