In my file system i have two directories containing subdirectories:
directory1
directory1_1
directory2
directory2_1
I want to serve both root directories (directory1, directory2) under the path /resources.
I tried to achieve this using serve-index (https://www.npmjs.com/package/serve-index):
app.use("/resources", serveIndex("/directory1", {icons:true}));
app.use("/resources", serveIndex("/directory2", {icons:true}));
The problem is, only the structure of directory1 is shown - directory2 is ignored.
I am looking for a way to serve the merged content of multiple directories.
Any ideas?
Thanks, Thomas
As i did not find a module, i implemented my own local module and took serve-index as a starting point.
The API now looks like this:
app.use("/resources", serveMergedIndex([ "directory1", "directory2" ]));
2 hours of work but works pretty well.
Thanks, Thomas
Related
I'm working on a large TS-based library. When I build the application, this creates a lot of .d.ts files, most of which are of internal use only, and make no sense to export or ship to the end user. Usually I've used a .npmignore file to keep these out, but recently learned that certain tools really prefer that information to be included via the "files" field of the package.json, so here I am trying to convert.
Now, I have a directory structure that looks somewhat like this:
dist/
--bundle.js
--...
--components/
----componentA.d.ts
----componentB.d.ts
----common/
----...
--hooks/
----...
--util/
----...
The idea is that I want all top level files, and all files directly under /components/ but no child directories. In my .npmignore, I'd do this like:
# blacklist all
**
# include whitelist
!dist/*
!dist/components/*
However, when I do the same under "files" in my package.json, all that crap still comes along. The single wildcard is not respected.
Edit:
"files": [
"dist/*",
"dist/components/*",
...
],
Reproducing what you show of your file system, this works for me:
"files": ["dist/*.js", "dist/components/*.ts"]
Omitting the file extensions indeed included all the subdirectory cruft. I tested with npm 7 and npm 6.
I have a dash app which needs to use 2 different css files. One is in the assets folder where the app is located, but the other one sits in a relative path, e.g under common
all_my_apps/
|--app1/
|--app1.py
|--assets/
|-- app1.css
|--app2/
|--app2.py
|--assets/
|-- app2.css
|--common/
|--common.css
I used to be able to do it (in dash 0.4.1) using static_url_path and flask.send_from_directory() which don't work anymore.
You could try symlinking your common.css inside the app asset folders. Something like cd app2/assets && ln -s ../../common/common.css
I already have the relative path: /home/Folder1/Folder2 which its original absolute path is /home/user1/Folder1/Folder2. And I have several scripts that are using /home/Folder1/Folder2. Now, I need to delete user1 so I created user2 with the same structure of user1 so now I have a new path which is /home/user2/Folder1/Folder2. If I delete user1, my scripts will then fail because they are using the relative path /home/Folder1/Folder2 which its original absolute path is /home/user1/Folder1/Folder2. So I want my new path /home/user2/Folder1/Folder2 to point to /home/Folder1/Folder2 so that my scripts won't fail and I don't want to go through the trouble of opening each script and change the relative path to my new created path. Any idea how I can do this?
I guess, you got confused between soft links and absolute/relative path.
I assume you have a soft link created from "/home/Folder1/Folder2" pointing to "/home/user1/Folder1/Folder2" and you want to delete user1 directory and create user2 directory with same structure. If my assumption is right, recreate the softlink "/home/Folder1/Folder2" to point to "/home/user2/Folder1/Folder2". Your existing scripts will work seamlessly.
SteamBot_Csgo_Bot\settings\Configuration
i have a js file in configuration folder and want to call a file in the steamBot_Csgo_Bot folder
i understand that ../ goes back one how do i go back 2 directories
You can go 2 directories back with the following
../../
Use ../ twice.
../../jsfile.js
I am working on this Yeoman project, and I am copying some files from a template to my new app directory.
This line is doing the job well:
this.fs.copyTpl(this.templatePath(''),
this.destinationPath(this.project_name_slugified+'/'));
Everything comes from the template folder and goes to the root folder of the project.
But when someone adds a flag '--nr' I want to exclude one subfolder that has been copied. So yo my-gen my_app_name --rf should copy EVERYTHING unless this subfolder.
I tried the !-glob notation, but it's not working. I did something like as first parameter:
[this.templatePath('**'),this.templatePath('!subfolder/subfolder_to_be_excluded')]
So second parameter was set to exclude the subfolder that is not necessary
I also tried deleting (delete method), but it seems that the file is not available immediately.
It's not working anyway. Any ideas? Promisifying the copyTpl would work?
By calling this.templatePath('!subfolder/subfolder_to_be_excluded'), you end up generating a broken path: /absolute/path/!subfolder/etc.
Use it without this.templatePath given you don't need the absolute path to apply the filtering.
this.fs.copyTpl(
[
this.templatePath('**'),
'!subfolder/subfolder_to_be_excluded'
],
this.destinationPath(this.project_name_slugified + '/'),
templateContext
);