-
Couldn't load subscription status.
- Fork 24
Description
From within a node directory, if docco-husky is run for files across sub-directories, then the reference to the style sheet is invalid if "./" is used as the prefix to the path
[node_project] $ docco-husky app.js ./routes/index.js ./test/sometest.js
The reference to docco.js from routes/index.js.html is "../../docco.css", whereas the path should be "../docco.css".
The reason for using "./" as a prefix, is that it allows the use of "find" with docco:
$ docco-husky `find ./ -type f -name '*.js'
A workaround for now is to pipe to a search & replace editor (e.g. sed / perl / awk) to strip:
$ docco-husky find ./ -type f -name '*.js' | sed -re 's/^\.\///g'
The bug can be found here, for example: resources/content.jade, line 2:
- root_path = (root_path == "./") ? root_path : root_path.replace(/[^\/]+/g, '..')
the regex matches "./" and replaces it with "../" (i.e. from current_dir to parent_dir).
This can be resolved by changing the regex to (/[^\/.]+/g, '..') I think (i have tested in my environment, but not thoroughly).
or
.replace(/^.//g,'').replace(/[^\/]+/g, '..')
there's probably a better way to implement this with regex though.