devbridge / Styleguide

MIT License
1.44k stars 87 forks source link

config files + relative paths / subdirectories #145

Open mindstorm opened 8 years ago

mindstorm commented 8 years ago

Actual, the config.txt is loaded from the actual style guide directory. $.getJSON('./config.txt', function (config) {

The categories config file is loaded absolute with the hostname: $.getJSON('//' + location.host + '/' + config.categories, function (categories) {

When you run a web server with multiple projects in different sub-directories, you get an error, that the categories.txt cannot be found (of course).

The styleguide should not be bound to the root-directory.

michelecocuccio commented 8 years ago

Hello, yeah I can see the problem here. In fact everything works for me except that I get this error in the Terminal:

Error: ENOENT: no such file or directory, open '/app/themes/nucreative-theme/styleguide/db/categories.txt'

I specified the path in my config file and all other files inside the /db/ folder are found. This one is not found (even if the path is exactly the same) and the server goes down.

Any quick fix for this?

adamjw3 commented 8 years ago

Hi

I have the same issue.

The structure of my projects is as follows

So i'm using browsersync task to load my site from the dist folder. so my path in the config.text for categories is

"categories": "/styleguide/db/categories.txt",

Which loads fine but then i get the same error as michelecocuccio

Error: ENOENT, no such file or directory 'C:\styleguide\db\categories.txt'

Anyway to fix this?

LukeTongue commented 8 years ago

I am having the same issue too, would be great if this can be fixed.

AshleyJBartlett commented 8 years ago

I think I am having the same issue. I have included mine as project/wwwRoot/styleguide and I'm having issues with styleguide finding the files it needs when the server is using wwwRoot as the root folder.

gangsthub commented 7 years ago

It's a mess with the paths in general.

I made it work by running the commands as the description says (via CLI aside the node_modules folder). You don't need to create neither the config.txt (why txt!?) file nor any file. The styleguide folder is created automatically. And the db files are created automatically.

Then, although variables files are relative to the root, projectLogo is relative to the index.html (generated).