Styleguide icon indicating copy to clipboard operation
Styleguide copied to clipboard

config files + relative paths / subdirectories

Open mindstorm opened this issue 8 years ago • 5 comments

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.

mindstorm avatar May 04 '16 13:05 mindstorm

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?

michelecocuccio avatar May 20 '16 11:05 michelecocuccio

Hi

I have the same issue.

The structure of my projects is as follows

  • dist
    • resources
    • styleguide -*.html
  • src
    • resources
    • *.html

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?

adamjw3 avatar Jun 24 '16 14:06 adamjw3

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

LukeTongue avatar Jun 28 '16 14:06 LukeTongue

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.

AshleyJBartlett avatar Aug 19 '16 15:08 AshleyJBartlett

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).

gangsthub avatar Aug 22 '17 10:08 gangsthub