rogden / tailwind-config-viewer

A local UI tool for visualizing your Tailwind CSS configuration file.
2.01k stars 111 forks source link

Export command expects './dist' folder #9

Closed ortuagustin closed 4 years ago

ortuagustin commented 4 years ago

Thanks for this work, it's a really cool idea :+1:

When exporting the viewer to a static site, using tailwind-config-viewer export CLI, it expects your build directory to be ./dist, see

https://github.com/rogden/tailwind-config-viewer/blob/decc9b923fa1ab41328e41cd765f1ffc45d99558/cli/export.js#L18

If you have any other build dir, say ./public, you get this:

internal/fs/utils.js:269
    throw err;
    ^

Error: ENOENT: no such file or directory, stat './dist'
    at Object.statSync (fs.js:1016:3)
    at Object.statSync (/home/agustin/development/personal-site/node_modules/graceful-fs/polyfills.js:307:34)
    at statSync (/home/agustin/development/personal-site/node_modules/tailwind-config-viewer/node_modules/fs-extra/lib/util/stat.js:10:52)
    at getStatsSync (/home/agustin/development/personal-site/node_modules/tailwind-config-viewer/node_modules/fs-extra/lib/util/stat.js:24:19)
    at Object.checkPathsSync (/home/agustin/development/personal-site/node_modules/tailwind-config-viewer/node_modules/fs-extra/lib/util/stat.js:49:33)
    at Object.copySync (/home/agustin/development/personal-site/node_modules/tailwind-config-viewer/node_modules/fs-extra/lib/copy-sync/copy-sync.js:24:38)
    at module.exports (/home/agustin/development/personal-site/node_modules/tailwind-config-viewer/cli/export.js:18:6)
    at Command.<anonymous> (/home/agustin/development/personal-site/node_modules/tailwind-config-viewer/cli/index.js:24:24)
    at Command.listener [as _actionHandler] (/home/agustin/development/personal-site/node_modules/tailwind-config-viewer/node_modules/commander/index.js:422:31)
    at Command._parseCommand (/home/agustin/development/personal-site/node_modules/tailwind-config-viewer/node_modules/commander/index.js:975:14) {
  errno: -2,
  syscall: 'stat',
  code: 'ENOENT',
  path: './dist'
}
ortuagustin commented 4 years ago

I've opened a PR here: https://github.com/rogden/tailwind-config-viewer/pull/10

rogden commented 4 years ago

Thanks for the report @ortuagustin ! Will look into shortly.

rogden commented 4 years ago

@ortuagustin Thanks for the PR. I believe the fix for the issue is slightly different than what you were suggesting in the PR. The ./dist directory that is to be copied into the specified outputDir needs to be the dist directory from within the tailwind-config-viewer package and not the current working directory. This directory contains the html/js etc that is used when you run the default serve command. The intention was to copy those files into the build outputDir to use for statically serving the app.

The issue you were experiencing should be fixed in v1.1.3. If there is another issue related to your PR let me know and thanks again for reporting the issue, much appreciated!